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?
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.
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.
@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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With