The commands you posted do a “optimized production build”, but if you want to do an actual release build to be published you also have to add --release.
sorry maybe I used the wrong words…I would like to generate the --prod apk so I can try on my device this type of apk, for example for testing if the white screen after the slash screen it’s gone or not. I don’t want to release my app on the stores yet, I’m still developing and testing the app.
If I add --release and run $ ionic cordova run android --prod --release I have the same identical errors.
Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins · ionic.zone
If you read the link I posted, you will learn that the current version of cordova-android is 7.1.1. No use continue debugging before you are using that versoin and post the ionic info and output of the failing command then.
After I run $ ionic cordova build android --prod I obtain this 0utput (the same that I’ve posted in my question.)
$ ionic cordova build android --prod
Running app-scripts build: --prod --platform android --target cordova
[14:52:10] build prod started ...
[14:52:10] clean started ...
[14:52:10] clean finished in 16 ms
[14:52:10] copy started ...
[14:52:10] deeplinks started ...
[14:52:10] deeplinks finished in 125 ms
[14:52:10] ngc started ...
[14:52:21] ngc finished in 10.89 s
[14:52:21] preprocess started ...
[14:52:21] preprocess finished in less than 1 ms
[14:52:21] webpack started ...
[14:52:24] copy finished in 14.11 s
Error: ./node_modules/tslib/tslib.es6.js
Module build failed: TypeError: Cannot read property 'type' of undefined
at Object.getEffectiveTypeAnnotationNode (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:9341:18)
at assignContextualParameterTypes (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:41652:25)
at checkFunctionExpressionOrObjectLiteralMethod (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:41948:29)
at checkExpressionWorker (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:42959:28)
at checkExpression (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:42898:42)
at checkBinaryLikeExpression (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:42475:29)
at checkBinaryExpression (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:42467:20)
at checkExpressionWorker (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:42980:28)
at checkExpression (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:42898:42)
at checkBinaryLikeExpression (C:\gitlab\veneto-app\node_modules\typescript\lib\typescript.js:42475:29)
@ ./node_modules/@angular/platform-browser/esm5/platform-browser.js 9:0-44
@ ./src/app/main.ts,./src/app/main.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'C:\gitlab\veneto-app\src\app'
resolve './app.module.ngfactory' in 'C:\gitlab\veneto-app\src\app'
using description file: C:\gitlab\veneto-app\package.json (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\gitlab\veneto-app\package.json (relative path: ./src/app)
using description file: C:\gitlab\veneto-app\package.json (relative path: ./src/app/app.module.ngfactory)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\gitlab\veneto-app\src\app\app.module.ngfactory doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\gitlab\veneto-app\src\app\app.module.ngfactory.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\gitlab\veneto-app\src\app\app.module.ngfactory.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
C:\gitlab\veneto-app\src\app\app.module.ngfactory.json doesn't exist
as directory
C:\gitlab\veneto-app\src\app\app.module.ngfactory doesn't exist
[C:\gitlab\veneto-app\src\app\app.module.ngfactory]
[C:\gitlab\veneto-app\src\app\app.module.ngfactory.ts]
[C:\gitlab\veneto-app\src\app\app.module.ngfactory.js]
[C:\gitlab\veneto-app\src\app\app.module.ngfactory.json]
[C:\gitlab\veneto-app\src\app\app.module.ngfactory]
@ ./src/app/main.ts 2:0-60
at new BuildError (C:\gitlab\veneto-app\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
at callback (C:\gitlab\veneto-app\node_modules\@ionic\app-scripts\dist\webpack.js:121:28)
at emitRecords.err (C:\gitlab\veneto-app\node_modules\webpack\lib\Compiler.js:265:13)
at Compiler.emitRecords (C:\gitlab\veneto-app\node_modules\webpack\lib\Compiler.js:371:38)
at emitAssets.err (C:\gitlab\veneto-app\node_modules\webpack\lib\Compiler.js:258:10)
at applyPluginsAsyncSeries1.err (C:\gitlab\veneto-app\node_modules\webpack\lib\Compiler.js:364:12)
at next (C:\gitlab\veneto-app\node_modules\tapable\lib\Tapable.js:218:11)
at Compiler.compiler.plugin (C:\gitlab\veneto-app\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (C:\gitlab\veneto-app\node_modules\tapable\lib\Tapable.js:222:13)
at Compiler.afterEmit (C:\gitlab\veneto-app\node_modules\webpack\lib\Compiler.js:361:9)