Differences between APK sizes [Uncompressed & Minified]

Hi everyone,

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.

Thanks for your time!

2 Likes

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?

Thanks again

Yes, crosswalk will increase the app size by about 60MB.

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.

Okay, well I guess it’s the cost to pay!

Thanks @mikemintz

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

Oh thanks a lot! I successfuly lost 15Mo because of this!

You’re the best @mhartington

1 Like

Hi,
I have ionic 1.3.3 and i have installed the stable version of crosswalk 10.39.235.15.
I tried the command:

BUILD_MULTIPLE_APKS=true ionic run android

But it doesn’t work. In the updated post of ionic its written that it should create two apks automatically.

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

http://ionicframework.com/blog/crosswalk-comes-to-ionic/

Yes, I have read that.
The problem is that i get always one apk of 70 MB when i run:

ionic run android or cordova run android

Should i run another command? should i look for the apks in different paths?

thanks

Interesting, let me check with @jbavari1 about this.

To address this, I must admit I was wrong.

Two have two separate architecture builds, it requires a gradle.properties file in your platforms/android directory.

In this file, place the following:

cdvBuildMultipleApks=true

We’re updating that blog post right now to have this fix. Sorry for leading you temporarily astray!

2 Likes

I added that file in my android directory and it worked! :smile:
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.

Thanks!

i have an app with size 2.3 MB and when i add crosswalk to it the size become 22.8 MB.
anyway that i can use to reduce this size!?

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?

Hey @ehorodyski,

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 :slight_smile:

Thanks @WidawskiJ!

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!