or123456
or123456

Reputation: 2199

apk big size with ionic 4 build

Before I got the output, it was 9 megabytes.
but now it is 17.8MB.
I opened apk in android studio with Analyze apk.
assets folder is very big and there are several numbers from each file.
enter image description here

ionic info:

Ionic:

ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework               : @ionic/angular 4.0.0-rc.2
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics    : 7.1.4
@angular/cli                  : 7.1.4
@ionic/angular-toolkit        : 1.4.0

Cordova:

cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms     : android 7.1.4
Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.1, (and 16 other plugins)

System:

Android SDK Tools : 26.1.1 (/home/omid/programming_tools/android-sdk)
NodeJS            : v10.15.0 (/usr/local/bin/node)
npm               : 6.8.0
OS                : Linux 4.20

I use of this command :

ionic cordova build android --prod --release

What has happened ?

Upvotes: 3

Views: 1095

Answers (1)

This is a massive flaw in ionic 4. I recommend following these build instructions:

Test APK:

Delete 'www' folder from project

ionic cordova build android --minifycss --optimizejs --minifyjs

Production APK:

Delete 'www' folder from project

ionic cordova build android --minifycss --optimizejs --minifyjs --release --prod

In theory --minifycss --optimizejs --minifyjs are all applied by --prod but you never know with Ionic

Upvotes: 2

Related Questions