@maccesar/titools 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +31 -60
  3. package/agents/ti-pro.md +3 -1
  4. package/commands/ti-audit.md +6 -4
  5. package/docs/examples.md +9 -0
  6. package/docs/knowledge-index.md +2 -1
  7. package/lib/config.js +1 -0
  8. package/package.json +1 -1
  9. package/skills/alloy-guides/SKILL.md +18 -179
  10. package/skills/alloy-guides/references/CLI_TASKS.md +17 -216
  11. package/skills/alloy-guides/references/CONCEPTS.md +27 -162
  12. package/skills/alloy-guides/references/CONTROLLERS.md +38 -236
  13. package/skills/alloy-guides/references/MODELS.md +47 -723
  14. package/skills/alloy-guides/references/MODELS_ADVANCED.md +21 -482
  15. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +12 -222
  16. package/skills/alloy-guides/references/VIEWS_STYLES.md +39 -358
  17. package/skills/alloy-guides/references/VIEWS_XML.md +36 -552
  18. package/skills/alloy-guides/references/WIDGETS.md +49 -127
  19. package/skills/alloy-howtos/SKILL.md +14 -169
  20. package/skills/alloy-howtos/references/best_practices.md +9 -113
  21. package/skills/alloy-howtos/references/cli_reference.md +18 -223
  22. package/skills/alloy-howtos/references/config_files.md +50 -133
  23. package/skills/alloy-howtos/references/debugging_troubleshooting.md +19 -63
  24. package/skills/alloy-howtos/references/samples.md +21 -138
  25. package/skills/ti-api/SKILL.md +10 -2
  26. package/skills/ti-api/references/api-android.md +36 -2
  27. package/skills/ti-api/references/api-app-platform.md +39 -3
  28. package/skills/ti-api/references/api-core.md +50 -18
  29. package/skills/ti-api/references/api-data-network.md +49 -35
  30. package/skills/ti-api/references/api-media.md +45 -27
  31. package/skills/ti-api/references/api-services.md +39 -9
  32. package/skills/ti-api/references/api-ui-android.md +33 -13
  33. package/skills/ti-api/references/api-ui-extras.md +41 -15
  34. package/skills/ti-api/references/api-ui-ios-animator.md +42 -26
  35. package/skills/ti-api/references/api-ui-ios.md +74 -2
  36. package/skills/ti-api/references/api-ui-lists.md +32 -16
  37. package/skills/ti-api/references/api-ui-text-input.md +34 -17
  38. package/skills/ti-api/references/api-ui-views.md +27 -1
  39. package/skills/ti-api/references/api-ui-windows-navigation.md +32 -18
  40. package/skills/ti-api/references/api-xml-global.md +66 -16
  41. package/skills/ti-create-release/SKILL.md +98 -0
  42. package/skills/ti-create-release/references/module-discovery.md +69 -0
  43. package/skills/ti-expert/references/adaptive-layouts.md +1 -1
  44. package/skills/ti-guides/SKILL.md +37 -76
  45. package/skills/ti-guides/references/advanced-data-and-images.md +122 -126
  46. package/skills/ti-guides/references/android-manifest.md +24 -83
  47. package/skills/ti-guides/references/app-distribution.md +31 -377
  48. package/skills/ti-guides/references/application-frameworks.md +127 -335
  49. package/skills/ti-guides/references/cli-reference.md +184 -633
  50. package/skills/ti-guides/references/commonjs-advanced.md +81 -231
  51. package/skills/ti-guides/references/compatibility-matrix.md +36 -75
  52. package/skills/ti-guides/references/hello-world.md +95 -70
  53. package/skills/ti-guides/references/hyperloop-native-access.md +52 -448
  54. package/skills/ti-guides/references/resources.md +174 -142
  55. package/skills/ti-guides/references/sdk-release-notes.md +28 -71
  56. package/skills/ti-guides/references/tiapp-config.md +222 -598
  57. package/skills/ti-howtos/SKILL.md +23 -123
  58. package/skills/ti-howtos/references/cross-platform-development.md +119 -324
  59. package/skills/ti-howtos/references/debugging-profiling.md +77 -445
  60. package/skills/ti-howtos/references/extending-titanium.md +199 -673
  61. package/skills/ti-howtos/references/local-data-sources.md +87 -300
  62. package/skills/ti-howtos/references/location-and-maps.md +86 -213
  63. package/skills/ti-howtos/references/media-apis.md +103 -223
  64. package/skills/ti-howtos/references/notification-services.md +86 -506
  65. package/skills/ti-howtos/references/remote-data-sources.md +97 -316
  66. package/skills/ti-howtos/references/using-modules.md +77 -133
  67. package/skills/ti-ui/SKILL.md +28 -143
  68. package/skills/ti-ui/references/icons-and-splash-screens.md +74 -403
  69. package/skills/ti-ui/references/layouts-and-positioning.md +175 -402
  70. package/skills/ti-ui/references/listviews-and-performance.md +100 -703
  71. package/skills/ti-ui/references/platform-conventions.md +180 -0
  72. package/skills/ti-ui/references/user-interface.md +43 -0
  73. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
  74. package/skills/alloy-howtos/references/custom_tags.md +0 -148
  75. package/skills/ti-guides/references/coding-best-practices.md +0 -149
  76. package/skills/ti-guides/references/javascript-primer.md +0 -414
  77. package/skills/ti-guides/references/reserved-words.md +0 -36
  78. package/skills/ti-guides/references/style-and-conventions.md +0 -103
  79. package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -624
  80. package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
  81. package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
  82. package/skills/ti-howtos/references/google-maps-v2.md +0 -172
  83. package/skills/ti-howtos/references/ios-map-kit.md +0 -149
  84. package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -611
  85. package/skills/ti-howtos/references/tutorials.md +0 -565
  86. package/skills/ti-howtos/references/web-content-integration.md +0 -287
  87. package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -124
  88. package/skills/ti-ui/references/accessibility-deep-dive.md +0 -288
  89. package/skills/ti-ui/references/animation-and-matrices.md +0 -569
  90. package/skills/ti-ui/references/application-structures.md +0 -626
  91. package/skills/ti-ui/references/custom-fonts-styling.md +0 -549
  92. package/skills/ti-ui/references/event-handling.md +0 -401
  93. package/skills/ti-ui/references/gestures.md +0 -448
  94. package/skills/ti-ui/references/orientation.md +0 -374
  95. package/skills/ti-ui/references/platform-ui-android.md +0 -727
  96. package/skills/ti-ui/references/platform-ui-ios.md +0 -576
  97. package/skills/ti-ui/references/scrolling-views.md +0 -288
  98. package/skills/ti-ui/references/tableviews.md +0 -542
@@ -1,487 +1,119 @@
1
- # Debugging and profiling
1
+ # Debugging & profiling
2
2
 
3
- Guide to debugging Titanium apps, managing memory, finding leaks, and using native tools.
3
+ Based on the [current official guide](https://titaniumsdk.com/docs/build/debugging.md). Examples target released SDK 13.4.1; verify the selected SDK before adopting version-specific behavior.
4
4
 
5
- <!-- TOC-START -->
6
- ## Contents
5
+ Most Titanium debugging is the log. The build streams it to your terminal until
6
+ you stop it, and `Ti.API` is what writes to it.
7
7
 
8
- - [Debugging overview](#debugging-overview)
9
- - [Memory management](#memory-management)
10
- - [Memory leak detection](#memory-leak-detection)
11
- - [Android debugging tools](#android-debugging-tools)
12
- - [iOS debugging tools](#ios-debugging-tools)
13
- - [6. Automation and UI testing](#6-automation-and-ui-testing)
14
- - [Best practices](#best-practices)
15
- - [Platform-specific notes](#platform-specific-notes)
16
- - [Resources](#resources)
17
-
18
- <!-- TOC-END -->
19
-
20
- ## Debugging overview
21
-
22
- ### Essential elements of debugging
23
-
24
- 1. Gather information: clear, accurate description of the problem
25
- 2. Reproduce: consistent steps to recreate the issue
26
- 3. Deduce: logical reasoning to isolate the cause
27
- 4. Experiment: try fixes iteratively, track what works
28
- 5. Be tenacious: methodical persistence wins
29
- 6. Track work: document bugs and solutions
30
-
31
- ### Debugging techniques
32
-
33
- 1. Print tracing (logging)
34
- ```javascript
35
- Ti.API.info(`Variable value: ${myVar}`);
36
- Ti.API.warn('Warning message');
37
- Ti.API.error('Error occurred');
38
- Ti.API.log('info', 'Custom level message');
39
- Ti.API.debug('Debug info'); // Only in dev mode
8
+ ```js
9
+ Ti.API.info('loaded 12 notes');
10
+ Ti.API.warn('no cached copy, fetching');
11
+ Ti.API.error(`request failed: ${e.error}`);
40
12
  ```
41
13
 
42
- 2. Crash log evaluation
43
- - Build logs (compilation errors)
44
- - Runtime logs (app crashes)
45
- - Simulator/Emulator logs
46
- - Device logs
47
-
48
- 3. Interactive debugging
49
- - Breakpoints in Studio/IDE
50
- - Variable inspection
51
- - Step-through execution
52
-
53
- ## Memory management
54
-
55
- ### How JavaScript manages memory
56
-
57
- Garbage collection: JavaScript uses automatic mark-and-sweep.
58
-
59
- 1. Interpreter scans memory periodically
60
- 2. Marks objects with active references
61
- 3. Destroys unmarked objects
62
- 4. Frees their memory
63
-
64
- Implication: objects with no references are cleaned up automatically.
65
-
66
- ### How Titanium manages memory
14
+ Six levels: `trace`, `debug`, `info`, `warn`, `error`, and `log` for an
15
+ explicit one. Filter the build's output with `--log-level`:
67
16
 
68
- Titanium bridges JavaScript and native OS objects:
69
-
70
- ```javascript
71
- // JavaScript object + Native proxy
72
- const button = Ti.UI.createButton({ title: 'Click me' });
17
+ ```sh
18
+ ti build --platform android --log-level warn
73
19
  ```
74
20
 
75
- Key rule: setting a JavaScript object to `null` destroys both the JavaScript object and the native proxy.
76
-
77
- ### Releasing memory properly
21
+ `info` is the default. Drop to `warn` when the SDK's own chatter is burying
22
+ yours, and raise to `trace` when the problem is in the build rather than the
23
+ app.
78
24
 
79
- Complete cleanup:
80
- ```javascript
81
- let view = Ti.UI.createView({ backgroundColor: 'white' });
82
- win.add(view);
25
+ > [!IMPORTANT]
26
+ > Log statements ship. `Ti.API.info` in a release build still runs and still
27
+ > writes, and anything you interpolated into it - a token, an email address - is
28
+ > readable on a connected device. Strip them or guard them before you
29
+ > distribute.
83
30
 
84
- // Later: remove and nullify
85
- win.remove(view);
86
- view = null; // Destroys native proxy
87
- ```
31
+ ## Breakpoints
88
32
 
89
- Incomplete cleanup (memory leak):
90
- ```javascript
91
- let view = Ti.UI.createView({ backgroundColor: 'white' });
92
- win.add(view);
33
+ The [Visual Studio Code extension](https://titaniumsdk.com/docs/setup/ide-integration.md) contributes a
34
+ `titanium` debug type, so you can set breakpoints in your JavaScript and step
35
+ through a running app rather than reading log output. The JetBrains plugin
36
+ debugs over the Chrome DevTools Protocol; on iOS it additionally needs
37
+ `ios-webkit-debug-proxy`.
93
38
 
94
- // Later: only remove
95
- win.remove(view); // view object still exists in memory
96
- ```
39
+ Without an editor integration there are no breakpoints. That is the honest
40
+ answer, and it is why the log matters as much as it does here.
97
41
 
98
- ### Parent-child relationships
42
+ ## LiveView
99
43
 
100
- ```javascript
101
- // Good: children not referenced elsewhere
102
- let view = Ti.UI.createView({
103
- backgroundColor: 'white'
104
- });
105
- view.add(Ti.UI.createButton({ title: 'Click' })); // Anonymous child
44
+ `--liveview` reloads the running app when you save, instead of rebuilding:
106
45
 
107
- win.remove(view);
108
- view = null; // Destroys view and button
109
-
110
- // Bad: children referenced separately
111
- const button = Ti.UI.createButton({ title: 'Click' });
112
- let view = Ti.UI.createView({ backgroundColor: 'white' });
113
- view.add(button);
114
-
115
- win.remove(view);
116
- view = null; // Destroys view, but button still exists
117
- button = null; // Now button is destroyed
46
+ ```sh
47
+ ti build --platform android --liveview
118
48
  ```
119
49
 
120
- ### Platform memory limits
121
-
122
- | Platform | Memory limit |
123
- | -------- | -------------------------------------- |
124
- | iPhone | ~10% of system memory |
125
- | iPad | 30-50 MB (smaller is better) |
126
- | Android | 24-32 MB heap (128 MB with large heap) |
127
-
128
- Notes for iOS:
129
- - Apple does not publish exact limits
130
- - The jetsam process can terminate your app
131
- - "Jetsam" in crash logs often means a memory issue
132
-
133
- Important: memory is not storage. A 16GB device does not mean 16GB for your app. Limits may be higher on newer devices, but optimize for the lowest common denominator.
134
-
135
- ## Memory leak detection
136
-
137
- ### Common leak sources
138
-
139
- 1. Global event listeners
140
- ```javascript
141
- // Leak: listener keeps reference to window
142
- Ti.App.addEventListener('custom:event', (e) => {
143
- // Uses window variables
144
- });
145
- ```
146
-
147
- Fix: remove listeners when closing window
148
- ```javascript
149
- const myHandler = (e) => {
150
- // Handle event
151
- };
152
-
153
- Ti.App.addEventListener('custom:event', myHandler);
154
-
155
- win.addEventListener('close', () => {
156
- Ti.App.removeEventListener('custom:event', myHandler);
157
- });
158
- ```
159
-
160
- 2. Objects in closures
161
- ```javascript
162
- // Leak: closure retains object reference
163
- function createWindow() {
164
- const data = []; // Large array
165
- return Ti.UI.createWindow({
166
- listener: () => {
167
- data.push('more'); // Closure reference
168
- }
169
- });
170
- }
171
- ```
172
-
173
- Fix: pass data as an argument instead of keeping it in a closure.
174
-
175
- 3. Hidden views
176
- ```javascript
177
- // Leak: hidden view still consumes memory
178
- view.visible = false; // Not enough
179
- ```
180
-
181
- Fix: remove and nullify when not needed
182
- ```javascript
183
- view.visible = false;
184
- parent.remove(view);
185
- view = null;
186
- ```
187
-
188
- ### Debugging memory on iOS (Instruments)
189
-
190
- Setup:
191
- 1. Open app in iOS Simulator
192
- 2. Xcode → Open Developer Tool → Instruments
193
- 3. Choose Allocations template
194
- 4. Choose Target → Your App
195
- 5. Click Record
196
-
197
- Key columns:
198
- | Column | What it shows |
199
- | ----------------------------- | ------------------------ |
200
- | Persistent Bytes (Live Bytes) | Memory currently in use |
201
- | #Persistent (#Living) | Active object count |
202
- | #Transient (#Transitory) | Ready to garbage collect |
203
-
204
- Identifying leaks:
205
- 1. Filter for `Ti` prefix (Titanium objects)
206
- 2. Watch #Living as you use the app
207
- 3. If it grows continuously, you have a leak
208
- 4. #Transitory growing is fine (will be GC'd)
209
-
210
- Example workflow:
211
- ```
212
- 1. Filter: "TiUITableView" (table views)
213
- 2. Open/close a table view screen
214
- 3. Click "Cause GC" (garbage collection)
215
- 4. Check if #Living returns to previous value
216
- 5. If not, the leak is in that screen
217
- ```
218
-
219
- ### Debugging memory on Android (DDMS)
220
-
221
- Setup:
222
- 1. Add to `tiapp.xml`:
223
- ```xml
224
- <android xmlns:android="http://schemas.android.com/apk/res/android">
225
- <manifest>
226
- <application android:debuggable="true">
227
- </application>
228
- </manifest>
229
- </android>
230
- ```
231
-
232
- 2. Build app for emulator
233
- 3. Open DDMS (Android Device Monitor)
234
-
235
- Monitoring:
236
- 1. Select your app process
237
- 2. Click Update Heap
238
- 3. Click Cause GC to force garbage collection
239
- 4. Watch Allocated and # Objects values
240
-
241
- Identifying leaks:
242
- 1. Note initial values after GC
243
- 2. Exercise app (open/close screens)
244
- 3. Click Cause GC again
245
- 4. If values do not return to baseline, there is a leak
246
-
247
- ## Android debugging tools
248
-
249
- ### DDMS (Dalvik Debug Monitor Service)
250
-
251
- Features:
252
- - View log output
253
- - Explore file system
254
- - Simulate network conditions
255
- - Simulate calls/SMS
256
- - Set GPS coordinates
257
- - Monitor memory
258
-
259
- #### Log output with DDMS
260
-
261
- 1. Open DDMS
262
- 2. Select device/emulator
263
- 3. View log in lower pane
264
- 4. Add filter: Log Tag = `TiAPI`
265
-
266
- #### Simulate network conditions
50
+ It re-runs your JavaScript against the app already installed. That is a second
51
+ or two rather than a minute, and it is the difference between iterating on a
52
+ layout and giving up on it.
267
53
 
268
- Emulator Control panel:
269
- - Voice/Data state (home, roaming)
270
- - Data speed and latency
271
- - Test app behavior in poor conditions
54
+ It does not pick up everything. A change to `tiapp.xml`, a new module, a native
55
+ dependency or anything in `platform/` needs a real build. When a change seems
56
+ to have no effect, that is the first thing to rule out.
272
57
 
273
- #### Simulate calls/SMS
58
+ ## Reading the platform's own logs
274
59
 
275
- Emulator Control → Telephony Actions:
276
- - Incoming voice call
277
- - Incoming SMS message
278
- - Test app interruption handling
60
+ Titanium's log is a filtered view. When the app dies without reaching your
61
+ handler, go under it.
279
62
 
280
- #### Set GPS coordinates
63
+ **Android**
281
64
 
282
- Emulator Control → Location Controls:
283
- - Enter latitude/longitude
284
- - Click Send
285
- - Emulator uses these as current location
286
-
287
- #### File system exploration
288
-
289
- Device → File Explorer:
290
- - Browse entire file system
291
- - Pull files (copy to computer)
292
- - Push files (copy to device)
293
- - Delete files
294
-
295
- #### Memory monitoring
296
-
297
- Less useful for Titanium (JavaScript runs in one process), but it can show overall memory trends.
298
-
299
- ### ADB (Android Debug Bridge)
300
-
301
- #### Log output
302
-
303
- ```bash
304
- # View all logs
65
+ ```sh
305
66
  adb logcat
306
-
307
- # Device only
308
- adb -d logcat
309
-
310
- # Emulator only
311
- adb -e logcat
312
-
313
- # Specific device
314
- adb -s emulator-5556 logcat
315
-
316
- # Filter for Titanium
317
- adb logcat -s TiAPI
318
- # or
319
- adb logcat | grep TiAPI
320
- ```
321
-
322
- #### File system
323
-
324
- ```bash
325
- # Open shell
326
- adb shell
327
-
328
- # List files
329
- ls -la
330
- cd /some/path
331
-
332
- # Exit shell
333
- exit
334
- ```
335
-
336
- #### Transfer files
337
-
338
- ```bash
339
- # Copy file TO device
340
- adb push local.txt /sdcard/local.txt
341
-
342
- # Copy file FROM device
343
- adb pull /sdcard/remote.txt local.txt
344
- ```
345
-
346
- #### Access SQLite databases
347
-
348
- ```bash
349
- adb shell
350
-
351
- # List databases
352
- ls /data/data/com.example.app/databases/
353
-
354
- # Open database
355
- sqlite3 /data/data/com.example.app/databases/mydb.sqlite
356
-
357
- # Query
358
- SELECT * FROM tablename;
359
-
360
- # Exit
361
- .exit
362
67
  ```
363
68
 
364
- ### Creating emulators
69
+ A crash in native code appears here and nowhere else. Filter to the app with
70
+ `adb logcat --pid=$(adb shell pidof com.example.hello)`.
365
71
 
366
- > **⚠️ AVD Manager moved to Android Studio**
367
- > The legacy `android` CLI (`android create avd`, `android avd`) was removed in Android SDK Tools 25.3. Use Android Studio's built-in **AVD Manager** (Tools → Device Manager) or the command-line `avdmanager` tool instead.
72
+ **iOS**
368
73
 
369
- Command line (modern):
370
- ```bash
371
- # List available system images
372
- sdkmanager --list | grep system-images
74
+ Open **Console.app**, select the device in the sidebar, and filter by the app
75
+ name. A crash also leaves a report under **Window, Devices and Simulators** in
76
+ Xcode.
373
77
 
374
- # Create AVD with avdmanager
375
- avdmanager create avd -n my_emulator -k "system-images;android-34;google_apis;x86_64"
78
+ ## When the build fails, not the app
376
79
 
377
- # Launch emulator
378
- emulator -avd my_emulator
379
- ```
80
+ A build failure and a runtime failure need different tools, and the first
81
+ question is which one you have.
380
82
 
381
- Android Studio (GUI): Tools → Device Manager → Create Device.
83
+ **Rule out the environment first.** `ti info` reports what it found and what is
84
+ wrong with it, and a build that broke without a source change is usually a
85
+ toolchain that moved underneath it.
382
86
 
383
- ### Modifying emulators
87
+ **Force a clean build.** `build/` is generated, and a stale one produces errors
88
+ that the source does not explain:
384
89
 
385
- Increase disk space: Edit `~/.android/avd/<NAME>.avd/config.ini`:
386
- ```
387
- disk.dataPartition.size=1024m
90
+ ```sh
91
+ ti clean
388
92
  ```
389
93
 
390
- Scale on-the-fly:
391
- ```bash
392
- # Get emulator port
393
- adb devices
394
- # emulator-5560
395
-
396
- # Connect with telnet
397
- telnet localhost 5560
398
-
399
- # Scale to 75%
400
- window scale 0.75
401
- ```
402
-
403
- ## iOS debugging tools
404
-
405
- ### Instruments
406
-
407
- Key templates for Titanium debugging:
408
- - Allocations: track object creation and live object counts. Look at Persistent Bytes (Live Bytes) and #Persistent (#Living).
409
- - Leaks: detect memory leaks in real time. Shows objects that are allocated but never released.
410
- - Time Profiler: identify CPU-intensive operations and bottlenecks.
411
- - System Trace: system-level events and thread activity.
412
- - Zombies: detect messages sent to deallocated objects (debug builds only). Useful for over-released objects.
413
-
414
- ### Xcode build debugging
415
-
416
- For native debugging, open the Xcode project in `build/iphone`:
417
- 1. Product → Profile
418
- 2. Choose Instruments template
419
- 3. More accurate than attaching to a running process
420
-
421
- ### Console logs
422
-
423
- Viewing in Studio:
424
- - Console panel shows build/run output
425
-
426
- Viewing separately:
427
- ```bash
428
- # For running apps
429
- tail -f ~/Library/Logs/CoreSimulator/<SIMULATOR_ID>/system.log
430
- ```
431
-
432
- ## 6. Automation and UI testing
433
-
434
- For CI/CD pipelines, automated deployment, and functional testing, see:
435
-
436
- - Automation with Fastlane and Appium: `automation-fastlane-appium.md`
437
-
438
- ## Best practices
439
-
440
- ### Memory management
441
-
442
- 1. Always nullify objects after removing them from the view hierarchy.
443
- 2. Remove event listeners when closing windows.
444
- 3. Avoid global variables; use namespaces or CommonJS.
445
- 4. Use a single execution context, not multiple URL-based windows.
446
- 5. Be careful with closures; they retain references.
447
- 6. Hide vs remove: hide for temporary, remove/nullify for permanent.
448
-
449
- ### Debugging
450
-
451
- 1. Log strategically and remove sensitive logs before production.
452
- 2. Use descriptive log messages and include variable values.
453
- 3. Test on real devices; simulators miss issues.
454
- 4. Profile early and often; do not wait for crashes.
455
- 5. Reproduce consistently; you cannot fix what you cannot reproduce.
456
- 6. Keep track of bugs; use an issue tracker.
457
-
458
- ### Performance
94
+ **Read upward.** A Gradle or Xcode failure prints a great deal after the line
95
+ that matters. The first error is the real one; everything below is consequence.
459
96
 
460
- 1. Avoid excessive polling; use events when possible.
461
- 2. Defer loading; load data as needed.
462
- 3. Optimize images; compress and use appropriate sizes.
463
- 4. Minimize bridge crossings; cache platform checks.
464
- 5. Test on slow networks; simulate poor conditions.
465
- 6. Profile before optimizing; measure first, then fix hotspots.
97
+ **A linker error usually means a module.** See
98
+ [using modules](https://titaniumsdk.com/docs/build/modules.md): a module built against an older SDK fails
99
+ at link time with a message that never names it.
466
100
 
467
- ## Platform-specific notes
101
+ ## Profiling
468
102
 
469
- ### Android
103
+ There is no Titanium profiler. Use the platform's:
470
104
 
471
- - Debuggable flag: required for native debugging
472
- - Large heap: enable in `tiapp.xml` if needed
473
- - ProGuard: can obfuscate and optimize code
474
- - Multidex: may be needed for very large apps
105
+ Android Studio's **Profiler** attaches to a running debug build for CPU, memory
106
+ and energy. Xcode's **Instruments** does the same on iOS, and the Allocations
107
+ and Leaks instruments are the ones worth learning.
475
108
 
476
- ### iOS
109
+ Both show you native frames. A JavaScript hot spot appears as time inside the
110
+ bridge, which tells you where to look rather than which line.
477
111
 
478
- - Instruments: most powerful tool for iOS profiling
479
- - Zombies: Instruments tool to find over-released objects
480
- - Allocation tracker: shows object creation and lifecycle
481
- - Time Profiler: identifies CPU bottlenecks
112
+ For the common Titanium performance problem, look first at lists: a
113
+ `TableView` with hundreds of rows, or a `ListView` whose item template does
114
+ work per row. [Lists and tables](https://titaniumsdk.com/docs/build/ui/lists.md) covers the difference.
482
115
 
483
- ## Resources
116
+ ## Next
484
117
 
485
- - Video: Your Apps are Leaking (Codestrong 2011)
486
- - Android DDMS docs: https://minimum-viable-product.github.io/marshmallow-docs/tools/debugging/ddms.html
487
- - iOS Instruments guide: Apple Developer Documentation
118
+ [Distributing apps](https://titaniumsdk.com/docs/distribute.md) covers signing and getting a build to
119
+ other people.