APK not being generated when using `--prod --release` flags


#1

I am trying to generate an APK using ionic cordova build android --prod --release but it stops after postprocess started ... with no errors or warnings. An APK is generated if I use ionic cordova build android

build output

[12:13:54]  build prod started ... 
[12:13:54]  clean started ... 
[12:13:54]  clean finished in less than 1 ms 
[12:13:54]  copy started ... 
[12:13:54]  ngc started ... 
[12:14:00]  ngc finished in 6.07 s 
[12:14:00]  preprocess started ... 
[12:14:00]  deeplinks started ... 
[12:14:00]  deeplinks finished in 224 ms 
[12:14:00]  optimization started ... 
[12:14:00]  copy finished in 6.45 s 
[12:14:10]  optimization finished in 9.35 s 
[12:14:10]  preprocess finished in 9.57 s 
[12:14:10]  webpack started ... 
[12:14:58]  webpack finished in 48.28 s 
[12:14:58]  sass started ... 
[12:14:58]  uglifyjs started ... 
[12:14:59]  sass finished in 663 ms 
[12:14:59]  cleancss started ... 
[12:14:59]  cleancss finished in 834 ms 
[12:15:12]  uglifyjs finished in 14.29 s 
[12:15:12]  postprocess started ... 

info info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.8.0

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2 
    ios-sim           : 6.1.2 
    Node              : v7.9.0
    npm               : 5.5.1 
    OS                : macOS Sierra
    Xcode             : Xcode 9.1 Build version 9B55 

Environment Variables:

    ANDROID_HOME : /Users/mbp/Library/Android/sdk

Misc:

    backend : pro

Plugins

You have been opted out of telemetry. To change this, run: cordova telemetry on.
cordova-admob-sdk 0.11.1 "AdMob SDK"
cordova-plugin-admob-free 0.11.0 "Cordova AdMob Plugin"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-nativestorage 2.2.2 "NativeStorage"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-promise-polyfill 0.0.2 "cordova-promise-polyfill"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"

Android build tools version 27.0.1


#2
  1. Maybe adding a verbose flag will give you some answers:

ionic cordova build android --prod --release --verbose

  1. Does a build work without the --prod flag?

#3

@ccdex_chris Yes ionic cordova build android --release works.

Output of ionic cordova build android --prod --release --verbose

[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/mbp/Documents/Development/app/app', local: false, binPath: 
        '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 911)
Running app-scripts build: --prod --platform android --target cordova
[13:46:11]  build prod started ... 
[13:46:11]  clean started ... 
[13:46:11]  clean finished in 3 ms 
[13:46:11]  copy started ... 
[13:46:11]  ngc started ... 
[13:46:20]  ngc finished in 8.84 s 
[13:46:20]  preprocess started ... 
[13:46:20]  deeplinks started ... 
[13:46:20]  deeplinks finished in 283 ms 
[13:46:20]  optimization started ... 
[13:46:20]  copy finished in 9.40 s 
[13:46:32]  optimization finished in 11.80 s 
[13:46:32]  preprocess finished in 12.08 s 
[13:46:32]  webpack started ... 
[13:47:27]  webpack finished in 55.34 s 
[13:47:27]  sass started ... 
[13:47:27]  uglifyjs started ... 
[13:47:28]  sass finished in 889 ms 
[13:47:28]  cleancss started ... 
[13:47:29]  cleancss finished in 922 ms 
[13:47:43]  uglifyjs finished in 16.15 s 
[13:47:43]  postprocess started ...