Titanium SDK 9.3+ AndroidX Compatibility: Should the SDK Enforce AndroidX‑Only Mode?
0 reputation · 06 Nov 2024, 10:28 UTC
0 reputation · 06 Nov 2024, 10:28 UTC
The 9.2.0 release resolved a documented memory leak in Ti.UI.WebView on Android by cleaning up native Chromium resources during the view’s destroy lifecycle. While this fix stabilizes heap usage, a new configuration boundary emerged with SDK 9.3.0: the build process defaults to AndroidX libraries, yet the SDK still ships legacy android.support shims. Developers must opt‑in via the useAndroidX flag in tiapp.xml to avoid duplicate class errors, leaving the decision to manage potential runtime crashes when both sets coexist.
Given this dual‑library state, the SDK team faces an unresolved policy question: should future major releases automatically enforce an AndroidX‑only mode and strip the support‑lib shims, or continue to leave the configuration to the developer? The choice impacts backward compatibility, build size, and runtime stability.
Key unresolved questions:
Ti.UI.WebView memory usage in current projects?No. Titanium SDK 9.3.x should not automatically enforce AndroidX-only mode and strip android.support shims in the next release unless the project explicitly opts in. The safer policy is to keep useAndroidX as a developer-controlled flag, document AndroidX as the default path forward, and treat removal of legacy shims as a breaking change for a future major version after module compatibility is confirmed.
SDK 9.3.0 defaults to AndroidX libraries during the Gradle build while still shipping legacy android.support shims. That dual state exists to avoid breaking existing apps and third-party modules compiled against the older support library. Forcing AndroidX-only mode would remove duplicate class errors, but it could also cause build failures or runtime ClassNotFoundException events in projects that still reference android.support classes directly or depend on modules that have not been migrated.
<useAndroidX>true</useAndroidX> under the Android section.Does the application or any installed Titanium module import android.support.* classes directly? If yes, enforcing AndroidX-only mode will break compilation or runtime, so the recommendation stays opt-in. If no, migration can proceed.
ti build -p android --build-only
Search the project for legacy references:
grep -R "android.support" --include="*.xml" --include="*.java" --include="*.js" .
If the grep returns no matches and the build succeeds, AndroidX-only mode is safe for that project. Use Android Studio Profiler to verify WebView heap behavior after the fix.
This answer assumes Titanium SDK 9.3.0 or later and a standard Gradle-based Android build. Claims about specific crash symptoms or APK size reduction are not verified against a live build and should be reviewed by the SDK team before release. The decision to strip shims should wait until third-party module maintainers confirm AndroidX compatibility.
Use comments to ask for clarification. Post a solution as an answer.
32,775 reputation · 06 Nov 2024, 15:38 UTC
When useAndroidX=true is set, Titanium adds android.useAndroidX=true and android.enableJetifier=true to the Gradle properties. Jetifier rewrites only the bytecode of compiled AAR/JAR dependencies, converting android.support.* references to their AndroidX equivalents. It does not modify resources, manifest entries, or native libraries, so any android.support references in AndroidManifest.xml or in JNI‑loaded .so files must be updated manually.