- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Due to intel cloud build deprecation, I setup a cordova cli build.
But I noticed that the apk size differs.
The cloud build is around 27MB
The cordova cli build (cordova build android --release --device) is over 50MB.
Only with shared crosswalk the two build size match (around 5MB)
Why I see this size difference?
Thank you
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Due to this line in the exported config.xml file:
<preference name="xwalkMultipleApk" value="false" />
This line causes the build to generate a "multiple architecture" Crosswalk APK file; meaning that both the x86 and the ARM Crosswalk libraries are included in your APK file. This is done because PhoneGap Build will only return a single APK file when it performs a build, unlike the XDK cloud build system, which returns a ZIP file that contains two APK files (one for each architecture).
Removing that line from the config.xml (or changing the value to "true") will generate two APK files, similar to what the XDK build system does (except they won't be bundled in a ZIP file). Unfortunately, it is not obvious, when you look at the messages created by the build system:
BUILD SUCCESSFUL Total time: 39.289 secs Built the following apk(s): /Users/username/Downloads/tmp/platforms/android/build/outputs/apk/android-debug.apk
But if you "cd" to this folder: "platforms/android/build/outputs/apk/" (within your build project) you will see something like the following:
$ cd platforms/android/build/outputs/apk/ $ ls -al total 395904 -rw-r--r-- 1 username staff 24M Mar 27 10:09 android-armv7-debug-unaligned.apk -rw-r--r-- 1 username staff 24M Mar 27 10:09 android-armv7-debug.apk -rw-r--r-- 1 username staff 46M Mar 27 10:06 android-debug-unaligned.apk -rw-r--r-- 1 username staff 46M Mar 27 10:06 android-debug.apk -rw-r--r-- 1 username staff 27M Mar 27 10:10 android-x86-debug-unaligned.apk -rw-r--r-- 1 username staff 27M Mar 27 10:10 android-x86-debug.apk
In this example, three APK images were created (ignoring the "unaligned" files): two with a single multi-architecture lib folder and one with a multi-architecture lib folder (the exact results of your build may vary as a function of the Cordova CLI version, the android-cordova framework version and the Crosswalk library version):
$ unzip -l android-debug.apk | grep " lib/" 36566392 03-27-2017 10:06 lib/armeabi-v7a/libxwalkcore.so 5192 03-27-2017 10:06 lib/armeabi-v7a/libxwalkdummy.so 54864996 03-27-2017 10:06 lib/x86/libxwalkcore.so 5188 03-27-2017 10:06 lib/x86/libxwalkdummy.so $ unzip -l android-armv7-debug.apk | grep " lib/" 36566392 03-27-2017 10:09 lib/armeabi-v7a/libxwalkcore.so 5192 03-27-2017 10:09 lib/armeabi-v7a/libxwalkdummy.so $ unzip -l android-x86-debug.apk | grep " lib/" 54864996 03-27-2017 10:09 lib/x86/libxwalkcore.so 5188 03-27-2017 10:09 lib/x86/libxwalkdummy.so
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I understand your detailed explanation, and using the xwalkMultipleApk I can control the apk size (due to library in both architecture)
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Giuseppe M,
Please try to below link to reduce apk size
https://www.npmjs.com/package/cordova-minify
Run install command from the link before "cordova platform add android" and "cordova build android" commands
It reduces my application with crosswalk size 47MB to 7.1MB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Paul,
I am trying to build an APK with Phonegap, but I prefer having the x86 and ARM APKs in different (smaller) files than in a big "multiple architecture" Crosswalk APK file, so I decided to follow your instructions:
Paul F. (Intel) wrote:
Due to this line in the exported config.xml file:
<preference name="xwalkMultipleApk" value="false" />[...]
Removing that line from the config.xml (or changing the value to "true") will generate two APK files, similar to what the XDK build system does (except they won't be bundled in a ZIP file).
[...]
I changed the value to "true" and now it builds a (small) x86 APK file but not the ARM version. Do you know what to do in order to build also the ARM APK?
Thank you for your help :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Paul F. (Intel) wrote:
Removing the
xwalkMultipleApk
tag from theconfig.xml
file (or changing the tag “value” to “true”) will result in generating two APK files, but they will not be bundled into a single ZIP file. Unfortunately, PhoneGap Build will only return one Crosswalk APK file to you, so changing this tag value to "true" is not advised if you are building a Crosswalk app with PhoneGap Build.
I included the entire paragraph from the doc pages, see the second sentence...
A long time ago someone created a plugin for PhoneGap Build that could be used to force PhoneGap Build to return one or the other Crosswalk APK if that xwalkMultipleApk tag was set to "true." However, I don't think it works anymore and it was very cumbersome to use (required doing multiple builds and making changes to some parameters between each build).
There is no practical way to do what you want with PhoneGap Build. If you want two Crosswalk APK files, like the XDK delivered, you'll have to use Cordova CLI to perform your builds, not PhoneGap Build.
One thing to keep in mind, the need for Crosswalk is much less now than it used to be. If you are deploying to Android 5 and later devices you do not need to use Crosswalk. If you are deploying to Android 4.4 and later devices you can probably get away without using Crosswalk. For most cases, the only time you might want to use Crosswalk is for deploying to Android 4.1-4.3 devices.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Paul F. (Intel) wrote:
A long time ago someone created a plugin for PhoneGap Build that could be used to force PhoneGap Build to return one or the other Crosswalk APK if that xwalkMultipleApk tag was set to "true." However, I don't think it works anymore and it was very cumbersome to use (required doing multiple builds and making changes to some parameters between each build).
So, is there no possible way to create an ARM and a x86 APK with Phonegap without using this Plugin?? I don't care if I have to do multiple builds and change some parameters between each build.
Paul F. (Intel) wrote:
One thing to keep in mind, the need for Crosswalk is much less now than it used to be. If you are deploying to Android 5 and later devices you do not need to use Crosswalk. If you are deploying to Android 4.4 and later devices you can probably get away without using Crosswalk. For most cases, the only time you might want to use Crosswalk is for deploying to Android 4.1-4.3 devices.
I understand, but Android 4.1-4.4 still makes up around 11% of my apps' users, so I guess I could upload a crosswalk version to target all these people and a version without crosswalk to target all Android 5+ devices. Anyway, what is the alternative to crosswalk? Native WebGL support?
If so, how do I remove crosswalk from my xdk project?
And I guess, without using crosswalk, I wouldn't need two APK files, am I right??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ches V. wrote:
So, is there no possible way to create an ARM and a x86 APK with Phonegap without using this Plugin?? I don't care if I have to do multiple builds and change some parameters between each build.
Using that tool is the only solution I've seen, if you are going to use PhoneGap Build. The alternative would be to use Cordova CLI directly to build your APK packages. I suppose you could take a combo Crosswalk APK and turn it into two architecture-specific APKs (one with each library) and then resign these two APK files. I don't know how hard this would be, you'd have to do some experimentation to see what it takes to make that happen.
Ches V. wrote:
I understand, but Android 4.1-4.4 still makes up around 11% of my apps' users, so I guess I could upload a crosswalk version to target all these people and a version without crosswalk to target all Android 5+ devices. Anyway, what is the alternative to crosswalk? Native WebGL support?
If so, how do I remove crosswalk from my xdk project?
And I guess, without using crosswalk, I wouldn't need two APK files, am I right??
If you are not using special Crosswalk features, there is no need for an alternative on Android 5+ devices. Are you using WebGL?
Assuming the Chrome webview that Android 5+ provides is sufficient (which I would expect to be the case), you could build a version without Crosswalk for Android 5+ devices (or even Android 4.4+ if the performance without Crosswalk is good enough on an Android 4.4 device). Then, you could build a non-Crosswalk version for the new devices and a Crosswalk version for the older devices.
For example, if your app works with Android 4.4+ without Crosswalk, then I would do this:
- build without Crosswalk for Android 4.4 and above (set min API level to 19)
- build with Crosswalk for Android 4.1-4.3 (set min API level to 16 -- note, this CW build can be a single-architecture package for ARM only, since there never were any x86 Android devices shipped with Android 4.1-4.3, they started at Android 4.4)
- make sure that the 4.1-4.3 package has an App Version Code that is less than or equal to the one in the Android 4.4+ package -- this is necessary to make sure the store delivers the correct package to your customer's devices, unfortunately, the Cordova build system plays games with this version code, so you need to double-check this when the package is built
To disable Crosswalk in the Build Settings, just clear the "optimize with Crosswalk" checkbox. If you build without Crosswalk you will get a single APK file, that will run on all architectures.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I will do this. Thank you for your help, Paul, I really appreciate it.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page