Ionic cordova run android --prod --release

I am trying to build release APK but getting the following error:

[11:31:46] copy started …
[11:31:46] deeplinks started …
[11:31:47] deeplinks finished in 481 ms
[11:31:47] ngc started …
[11:31:49] ionic-app-script task: “build”
[11:31:49] TypeError: Object prototype may only be an Object or null: undefined
TypeError: Object prototype may only be an Object or null: undefined

I have already tried removing node_modules and also run npm install but no success.

Ionic Info:
Ionic:

Ionic CLI : 5.2.0 (C:\Users\Dell\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0, browser 5.0.1
Cordova Plugins : cordova-plugin-ionic-webview 1.1.1, (and 10 other plugins)

Utility:

cordova-res : 0.5.1
native-run : 0.2.8

System:

Android SDK Tools : 26.1.1 (C:\Users\Dell\AppData\Local\Android\Sdk)
NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

I had the same problem. You need run: Ionic cordova build android –release. That is, without flag --prod.

1 Like

Hi,

consider this a workaround…not a solution as there is still an issue in your code…

ionic build --aot to continue the debugging without the lengthy cordova tail part…

Tom

ionic build --aot is also giving same error.

I have tried with Ionic cordova build android –release and done the job but apk is not optimized.

1 Like