Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce Cordova apk's size

Tags:

cordova

I am developing a hybrid app and now I am in a quandary over phonegap and cordova. Cordova is now in my PC and when I do a

cordova build android

I get an apk that's 3.7 mb, Nevertheless, if I use the build.phonegap.com route, the .apk is only 1.2 mb.

I tried deleting all the unnecessary plugins and even then the build size didnt change

How do I reduce the size of my cordova apk?

like image 710
lonelymo Avatar asked Oct 02 '14 18:10

lonelymo


People also ask

How do I reduce the size of an ionic app?

Some of the ways to reduce the apk size: Take prod build - It would minify and uglify the code. Use the following comment. ionic cordova build android —prod.

Can you compress APK files?

You can compress an APK file (rar, zip), but it has to be decompressed in order to work. ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions.


2 Answers

@frank's comment is the answer
You can delete all the images located in the platforms\android\res directory if you don't need a splash image to be shown. I reduced my app size from 2MB to 800KB, over 50% reduction.

like image 179
lonelymo Avatar answered Sep 27 '22 19:09

lonelymo


Try using "cordova build android --release" this command also reduces the apk file size

Delete www directory before you give build so that old build files will not come to new build.

like image 42
ssomu Avatar answered Sep 27 '22 20:09

ssomu