[TIMOB-26128] Android: Allow asset directory names with a leading underscore to be included in the build
GitHub Issue | n/a |
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-09-19T21:33:47.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.5.0 |
Components | Android |
Labels | android, assets |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2018-06-13T18:49:05.000+0000 |
Updated | 2018-10-09T12:32:38.000+0000 |
Description
*Summary:*
Directory names have a leading underscore '_' (ex: "_MyDirectory") are automatically excluded from the built Android APK's "assets" directory. Google did this intentionally with their "aapt" command line tool. We should change this behavior since iOS and Windows doesn't have this restriction. (Makes it less confusing too.)
For JavaScript files under these directories, they will only be excluded when building for the emulator since they're added to the APK's "assets" directory in this case. For "device" and "production" builds, the JavaScript will be correctly included, but this is because they're compiled/encrypted and not bundled under the APK's "assets" directory in this case.
*Steps to reproduce:*
Create a Titanium "Classic" app.
Copy the attached [^Test.zip] file's contents to your app.
Build and run the app for the Android emulator.
On app startup, a runtime error will occur where require()
will fail to find the JavaScript file under directory "_Test".
Build and run the app to an Android device. _(Note the emulator.)_
On app startup, note that a window is displayed, but it fails to display an image. _(The JS files was loaded, but the "_Test/AppcLogo.png" did not get included into the APK.)_
*Cause:*
Google's command line tool "aapt" will automatically exclude the following from the APK's assets directory:
* .svn
* .git
* .ds_store
* .scc
* .CVS
* thumbs.db
* picasa.ini
* _
We can change this behavior by using "aapt" argument --ignore-assets
and tell it not to omit directories with a leading underscore.
Attachments
File | Date | Size |
Test.zip | 2018-06-13T20:47:56.000+0000 | 52679 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10112
FR Passed. Directories with "_" are included in the apk & assets in the test are displayed as expected. Studio Ver: 5.1.1.201809051655 SDK Ver: 7.5.0 local build OS Ver: 10.13.5 Xcode Ver: Xcode 9.4.1 Appc NPM: 4.2.13 Appc CLI: 7.0.6 Daemon Ver: 1.1.3 Ti CLI Ver: 5.1.1 Alloy Ver: 1.13.2 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 10.0.2 Devices: ⇨ google Nexus 5 (Android 6.0.1) ⇨ google Pixel (Android 9) Emulator: ⇨ Android 4.1.2
PR Merged.
*Closing ticket.* Fix can now be verified in SDK version
7.5.0.v20181008124804
. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10112