Ionic 2 - Build Prod - Generates Debug apk


I am trying to build using ionic build android --prod however instead of generating a release apk it generates a debug apk.

Any help is greatly appreciated.

Thank you !

If anyone is running into this the proper command to build for release is now the following:

ionic build --prod --release

so use both to generate the release apk.

Are you sure? I see the following:
ionic build android --prod --release


[22:11:55] ionic-app-scripts 1.0.0
[22:11:55] build dev started …
[22:11:55] clean started …
[22:11:55] clean finished in 14 ms
[22:11:55] copy started …
[22:11:55] transpile started …

I am on ionic 2.0.0, just updated. In fact, for me all combinations of only --prod and with --release only lead to a build dev.
Is this expected? I recall being asked to remove the prod configuration as part of one of the ionic updates.

1 Like

Is that the complete result of your build process, or is there a second verse? Personally, I think it’s a bad idea, but ionic-app-scripts compiles your app twice. I believe first transpiling to ES5, and then invoking ngc.

It seems that my issue happen because of these scripts in the package.json:

"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build"

I copied the following based on the current start projects:

"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"

Maybe the --prod was somehow getting sent to the wrong script? Anyways, now I see the prod build as expected.

Currently i am working with ionic 4 application and i have installed all required things like Nodejs, cordova, Ionic, Git, Android Studio, JDK, Android SDK Tools…etc. The web application is working fine with any browser, But i could not create/generate .apk and .ipa files for the mobile devices for my existing ionic application, Please help me on this.

Thank You !..