Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce Cordova Chrome App (cca) APK Size

I've put together a Chrome App using Polymer and wanted to install it on the Android platform. I've successfully followed the steps listed here, compiled and deployed an SDK:

https://github.com/MobileChromeApps/mobile-chrome-apps

The problem, is that my chrome app is only 37k, and the compiled SDK is 37Mb. I tried also compiling down the 'Hello World' sample and got a similar file size.

While I anticipated there would be some overhead this seems remarkably high. I'm assuming it's because the cca command line automatically pulls in all anticipated plugins that you might need, even though I'm probably using very few (if any) of them.

Is there a way to reduce the file size on apps built with cca - or is this just a limitation while it's in its early developer preview stages?

Cheers!

like image 636
bittenbytailfly Avatar asked Oct 01 '22 06:10

bittenbytailfly


1 Answers

The large size of Chrome Apps for Mobile (using the cca tool) is due to us bundling the Crosswalk WebView automatically, which is currently based on Chrome/36. (This is also an approach we are working hard to get in to cordova-android 4.0 to be release later this year).

At the moment, we build a single apk with support for both intel and arm. We will soon split up the build into separate apks for each architecture, and thus cut the apk size overhead by half. We do expect there to be around ~18Mb overhead using this approach for the foreseeable future, though.

If you would really like, you can opt-out of using crosswalk by adding "webview": "system" to your manifest.mobile.json and rebuilding your project (but there may be a bug here at the moment, see issue for workaround).

You can read more information from our Release Notes, but we've got on our backlog to write up a whole FAQ about this approach.

You should know that even on the latest Android KitKat 4.4.3, the system webview will not run Polymer components without polyfills. Most polymer apps run dog slow without the Crosswalk webview (since Chrome/36 is first version to run polymer components natively).

Hope that helps you evaluate your options, and hopefully we can cut the apk size asap. Best of luck!

like image 108
mmocny Avatar answered Nov 15 '22 07:11

mmocny