Running Android Prod: Uncaught ReferenceError: AppRootToken is not defined


ionic (Ionic CLI): 4.4.0
Ionic Framework: ionic-angular 3.9.2
@ionic/app-scripts : 2.1.4
cordova (Cordova CLI): 7.1.0
Cordova Platforms: android 6.4.0, ios 4.5.4
Android SDK Tools: 26.0.2
npm: 5.10.0
NodeJS: v9.2.1

When running ionic cordova run android --prod Ill get the error “Uncaught ReferenceError: AppRootToken is not defined. at Function.n.forRoot” which will not run the app on the android device (stuck on white screen). If I run ionic cordova run android it will work. I’ve only noticed this after I upgraded to wkwebview, not sure if there is a correlation.

AppRootToken is not defined in android prod build

Same error here ! Did you find any fix for this issue ?


Try downgrading your Typescript version to 2.6.2 in your package.json

"typescript": "2.6.2"

That worked for me


This worked for me. Thanks a ton !