Hi, i’ve spent some days trying to reduce the apk size with crosswalk, and finally i made it so i want to share with the ionic community the way, i think is interesting to have a cross-android-version app that weights 10 MB less than the normal crosswalk .
First of all the reason why it always goes to download the normal binaries is that the crosswalk-lite is not in official release, but i had no problems with my app so here we go: Go to your project folder than edit this file:
platforms/android/cordova-plugin-crosswalk-webview/yourapp-xwalk.gradle
replace
repositories {
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
to be
repositories {
mavenLocal()
}
then add near the line 71 after cdvPluginPostBuildExtras.add({:
def liteSpec = "org.xwalk:xwalk_core_library:1.0.0.1"
and edit the dependecies rule to be
dependencies {
compile liteSpec
}
remember that 1.0.0.1 is our self created version
Now download from the crosswalk-lite repository the version you want to embed, i have tested with the version 17.46.451.1 , download just the .aar file. This version has both x86 and armv7 reources so you have to unzip the .aar (is actually a zip file ) and then delete the file
res/raw/libxwalkcore.so.x86 [ if you want to make apk for armv7 devices ]
res/raw/libxwalkcore.so.armeabi_v7a [ if you want to make apk for x86 devices ]
this is because it will trigger the error duplicate resources, as i noticed.
Now zip again the folder without the resource and rename it to .aar
And finally the magic touch, (if you haven’t installed maven do apt-get install maven2)
mvn install:install-file -Dfile=*YOURFILE*.aar -DgroupId=org.xwalk -DartifactId=xwalk_core_library -Dversion=1.0.0.1 -Dpackaging=aar
Now you can build your app with the crosswalk-lite embbeded, it may seems difficult but it’s not , and it worth every mb saved to the apk