1
When I use the command Ionic Cordova build android, the program compiles perfect but only add --Prod that does not compile. Error says that the program structure changed during code generation :
Error: Internal Error: The Structure of the program changed During codegen.
This code created in 2018/2019, in Ionic 4, from then on, Ionic evolved, Cordova tb. Trying to recreate the situation at the time, I reinstalled Node using NVM, pulled the 2019 version Node, and installed Ionic and Cordova. I upgraded all the dependencies, because I needed Cordova 9 for a plugin update. This update gave problem in SQLITE, it cost to fix, however, I think the solution is to understand what q compile the app for production (-Prod) does exactly pq the build without it gives no problem and the app runs on the perfect mobile. I need --Prod pq a google play store does not accept app in debug version.
See the result of the build attempt below:
ionic cordova build android --prod --verbose
ionic:bootstrap local CLI 4.12.0 found at D:\dev\guiatijucano\node_modules\ionic\package.json +0ms
ionic:lib Terminal info: { tty: true, ci: false, windows: true } +0ms
ionic:lib CLI global options: { _: [ 'cordova', 'build', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, prod: true, project: null, '--': [] } +20ms
ionic:lib:project Project type from config: Ionic 2/3 (ionic-angular) +0ms
ionic:lib:project Project details: { configPath: 'D:\\dev\\guiatijucano\\ionic.config.json', errors: [], context: 'app', type: 'ionic-angular' } +5ms
ionic Context: { binPath: 'D:\\dev\\guiatijucano\\node_modules\\ionic\\bin\\ionic', libPath: 'D:\\dev\\guiatijucano\\node_modules\\ionic', execPath: 'D:\\dev\\guiatijucano', version: '4.12.0' } +0ms
ionic:lib:integrations:cordova:config Using config.xml: D:\dev\guiatijucano\config.xml +0ms
ionic:lib:telemetry Sending telemetry for command: 'ionic cordova build' [ 'android', '--prod', '--verbose', '--interactive', '--color' ] +0ms
ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
ionic:lib:project:ionic-angular:build Looking for ionic:build npm script. +0ms
> ionic-app-scripts build --prod --target cordova --platform android
[20:49:58] ionic-app-scripts 3.2.4
[20:49:58] build prod started ...
[20:49:58] clean started ...
[20:49:58] clean finished in 75 ms
[20:49:58] copy started ...
[20:49:59] deeplinks started ...
[20:50:01] deeplinks finished in 1.85 s
[20:50:01] ngc started ...
[20:50:41] ionic-app-script task: "build"
[20:50:41] Error: Internal Error: The structure of the program changed during codegen.
Error: Internal Error: The structure of the program changed during codegen.
at AngularCompilerProgram._updateProgramWithTypeCheckStubs (D:\Dev\guiatijucano\node_modules\@angular\compiler-cli\src\transformers\program.js:466:19)
at D:\Dev\guiatijucano\node_modules\@angular\compiler-cli\src\transformers\program.js:148:23[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts build --prod --target cordova --platform android exited with exit code
1.
Re-running this command with the --verbose flag may provide more information.
ionic:utils-process onBeforeExit handler: process.exit received +0ms
ionic:utils-process onBeforeExit handler: running 1 functions +4ms
ionic:utils-process error while killing process tree for 12832: { Error: Command failed: taskkill /pid 12832 /T /F
ionic:utils-process ERRO: o processo "12832" n�o foi encontrado.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:289:12)
ionic:utils-process at ChildProcess.emit (events.js:182:13)
ionic:utils-process at maybeClose (internal/child_process.js:970:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:257:5)
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 12832 /T /F' } +471ms
ionic:utils-process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 12832 /T /F
ionic:utils-process ERRO: o processo "12832" n�o foi encontrado.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:289:12)
ionic:utils-process at ChildProcess.emit (events.js:182:13)
ionic:utils-process at maybeClose (internal/child_process.js:970:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:257:5)
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 12832 /T /F' } +15ms
ionic:utils-process onBeforeExit handler: exiting (exit code 1) +5
I believe that there is some incompatibility in the packages. I did an outdated npm and upgraded to the version-supported limit. Below is an extract of the package.json file
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "~4.11.0",
"@ionic-native/device": "^4.20.0",
"@ionic-native/device-motion": "^4.20.0",
"@ionic-native/device-orientation": "^4.20.0",
"@ionic-native/diagnostic": "^4.20.0",
"@ionic-native/geolocation": "^4.20.0",
"@ionic-native/native-storage": "^4.20.0",
"@ionic-native/network": "^4.20.0",
"@ionic-native/push": "^4.20.0",
"@ionic-native/qr-scanner": "^4.20.0",
"@ionic-native/screen-orientation": "^4.20.0",
"@ionic-native/splash-screen": "~4.11.0",
"@ionic-native/sqlite": "^3.14.0",
"@ionic-native/status-bar": "~4.9.2",
"@ionic/storage": "2.1.3",
"chart.js": "^2.8.0",
"cordova": "^10.0.0",
"cordova-android": "9.0.0",
"cordova-plugin-add-swift-support": "^1.7.2",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-device-motion": "^2.0.1",
"cordova-plugin-device-orientation": "^2.0.1",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-ionic": "^4.2.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.4.1",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-qrscanner": "^2.6.2",
"cordova-plugin-screen-orientation": "^3.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "5.1.0",
"cordova.plugins.diagnostic": "^4.0.12",
"emulator": "0.1.0",
"es6-promise-plugin": "^4.2.2",
"ionic": "^4.12.0",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"moment": "^2.24.0",
"node-sass": "^4.14.0",
"rxjs": "^5.5.12",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.4",
"@ionic/lab": "^3.2.10",
"typescript": "~4.1.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-network-information": {},
"cordova-plugin-device": {},
"cordova-plugin-device-orientation": {},
"cordova-plugin-device-motion": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-geolocation": {
"GPS_REQUIRED": "true"
},
"cordova.plugins.diagnostic": {
"ANDROID_SUPPORT_VERSION": "28.+"
},
"cordova-plugin-nativestorage": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-qrscanner": {},
"cordova-plugin-statusbar": {},
"cordova-sqlite-storage": {}
and Ionic info
Ionic:
ionic (Ionic CLI) : 4.12.0
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4
Cordova:
cordova (Cordova CLI) : 10.0.0
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, (and 12 other plugins)
System:
NodeJS : v11.1.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10