[AC-6285] Very heavy app!
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2019-06-18T11:23:36.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Giorgio Tassistro |
Assignee | Shak Hossain |
Created | 2019-06-11T20:07:52.000+0000 |
Updated | 2019-06-18T11:23:36.000+0000 |
Description
I made a very simple app, a two .js, with 5 views in 2 webView. It has practically no images, yet once the APK is made the weight reaches 14mb, on Apple 8Mb.
Is there anything you can do to lighten it?
Hello, You should follow the guide in this blog post https://devblog.axway.com/mobile-apps/optimising-titanium-app-file-sizes/. This will help you reduce the size of the APK. Thanks.
When you build a "production" APK, we remove the x86 architecture (mostly intended for the Android emulator) by default which will lower the APK size by about a third. It still won't be as small as an iOS app build, but it will be smaller than a test/development build.
Ok ... I do some research ... But how much "weight" axway, for an app (of default) ? If I don't use "Alloy" and i use only titanium, how much space do I save? For example, I do not use maps, geolocation, camera, and more. Can I exclude some modules to be lighter ?
The Google V8 JavaScript runtime C/C++ library we are embedding within the APK is what's adding significant "weight" to it. This library is needed to execute the project's JS files. And since it's a C/C++ library, we have to build it for each architecture such as ARMv7, ARM64, and x86. That's why removing the x86 version of that library via a "production" build lowers the APK size so significantly. You really can't make it any "lighter". Titanium by default already excludes other large libraries by default... such as anything that requires the Google Play Services like "ti.map". Side Note: On iOS, Titanium uses Apple's JavaScriptCore library built into the operating system. Unfortunately, the Android OS does not offer a built-in JavaScript runtime for us to use and we're therefore forced to include a runtime library within the app.
Joshua, all clear, thanks for the complete answer. I understand why on iOs it is 40% lighter.
[~gtassistro] you can do some crazy hacks with a native app to reduce the size: https://fractalwrench.co.uk/posts/playing-apk-golf-how-low-can-an-android-app-go/ e.g. changing the spp name, remove items from the manifest or even remove fields from the keystore file :-) But I'm not sure if that is really practical but it's a nice read!
For Android you could compile an APK for each architecture and upload them separately to the play store using the
<abi>
tiapp property. https://wiki.appcelerator.org/display/guides2/tiapp.xml+and+timodule.xml+Reference#tiapp.xmlandtimodule.xmlReference-abi On iOS you can make the app smaller by removing all splash screens and sticking with launch storyboard https://wiki.appcelerator.org/display/guides2/iOS+Launch+Files#iOSLaunchFiles-OptionA:UsethebuiltinStoryboard Hope that helps even more!