File.read() is unable to read encrypted assets such as .js files. This only happens when doing a device build or production build. It can only read .js files from the "Resources" directory when building for the Android Emulator (aka: "development" build) since .js files are not encrypted in this case.
iOS is able to successfully read encrypted assets such as .js.
Steps to Reproduce:
- Create a Titanium app with the below code for it's "app.js".
- Build and run on the Android emulator.
- Notice that the alert dialog displays the "app.js" code. (This is good.)
- Build and run on a physical Android device.
- Notice that the alert dialog on startup is empty. (This is bad. Failed to read "app.js".)
Android should be able to read encrypted .js files just like iOS.
Original description from Alejandro:
You have a .js file at Resources/lib named library.js with content:
if you try read the file like a text plain file
value should be var a = \"hello world\";, but value is empty -> "".
if you change library.js to library.lib or other extension is fine.