I’m having trouble understanding how come I have so few differences in build size when using a minified and uncompressed version of my www folder. Here’s a table depicting what I’m talking about
As you can see, there’s a huge difference in size between my uncompressed and minified www folder (18.4Mo) which reduces to only 5Mo when built (and 13 times the minified folder size).
I’d also like to know why there is such a gap between the apk file and the installed app (almost twice the size).
For the record : I’m using the last version of ionic, with the last CLI version (1.3.0-beta1), combined with crosswalk installed with the CLI.
APK files are compressed. Try comparing a zipped version of your unminified and minified www folders, and you’ll probably not see as major a difference. Your final APK is probably about 3MB of www and 35MB of everything else (mostly crosswalk).
I think the installed app is uncompressed, so that’s why the size on device is larger than the APK size.
Thank you for your answer. I do know that APK files are compressed, and uncompressed when installed, but we’re not talking a 20% reduction but literally twice the size of the apk file, never saw that before.
Also, I know crosswalk takes a lot of place, but again by that logic, with a 3Mo original www folder we have a 67Mo app : Does that mean that crosswalk takes up to 60Mo? (30x the original size)
For obvious reasons, I need my app to be under the 50Mo bar, do you have any idea on how to achieve that?
How big is the Crosswalk runtime, and how will it affect my application’s size?
To give a rough idea, the HTML/JS/CSS for one of the project’s sample applications takes up 24Kb of disk space.
Once this application is packaged with its own Crosswalk 10 (x86 Android) runtime, the apk file size is ~20Mb. Installed, the application takes ~58Mb of disk space.
So there seems to be some misconnect about why crosswalk has a large footprint.
From the looks of you numbers, you are probably bundling both x86 and arm7 binaries of crosswalk in your builds.
So to get around this, there’s a flag you can pass in to separate the builds out.
$ BUILD_MULTIPLE_APKS=true ionic run android
This should separate the builds and give you a much small file size
Yes, in the 1.3.3 update, we changed it so that it would do multiple builds by default.
Update: Previously you needed an environment variable to build multiple architectures. Do to some changes on the underlying Cordova Android library, you no longer need to specify the environment variable to build multiple APKs. This should happen by default by running ionic build android
I added that file in my android directory and it worked!
The building created 2 apks of 21 and 24 MB.
I have noticed that cdvBuildMultipleApks=true is in another file: > xwalk.gradle in ionic_xwalk_project.
Then i have installed the apk in my device and it took 56 MB of memory. Its less than 70 MB of last time but still maybe too much considering that is the initial app.
Is it really worth a 60MB increase for Crosswalk? To put this in context, I’m building an app to ship globally. We notice a performance boost with Crosswalk, but for someone using a poor connection in India, or Africa, or China – a 20MB increase can be painful.
Should we be looking towards optimizing our app further, perhaps removing some of the heavier components (like horizontal scroll libraries in exchange for a different look-and-feel), or am I overtly concerned?
More of a theoretical, but considering how much extra Crosswalk pads your app size and the current state of Android WebView, is Crosswalk worth it?
As shown in the graph above, optimizing your app won’t do a lot here as the 20Mo uncompressed are inevitable.
You can only compress your app so much (mine was 2.9Mo minified, but still 38.4Mo on build).
As to answer your theoretical question: Crosswalk becomes useless past Android 4.4. If I remember correctly, you can create two exports, one with crosswalk for < 4.4 Android users, and another crosswalk-free for those > 4.4.
I feel like pre-4.4 Android really need crosswalk, performances being really poor below this point
I realize how poorly I phrased what I was looking to get answered, but you nailed it on the head.
Thank you for the clarification! With consideration to how quickly our world revolves these days, it’s always nice to take an audit of the tools out there. This thread is from a year ago – a lot changes in a year!