My app was running fine. I now have this problem upon installing @nativescript/firebase
System.err: An uncaught Exception occurred on "main" thread. System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'ads' of undefined System.err: File: (file: src\webpack:\games-app\webpack\bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src\webpack:\games-app\node_modules\@nativescript\firebase\firebase.android.js:24:0) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.component.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:238:80) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:397:72) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:33:73) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at __webpack_exec__(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8119:39) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:189) System.err: at __webpack_require__.X(file: src\webpack:\games-app\webpack\runtime\startup entrypoint:6:0) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:47) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8125:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'ads' of undefined System.err: System.err: StackTrace: System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'ads' of undefined System.err: File: (file: src\webpack:\games-app\webpack\bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src\webpack:\games-app\node_modules\@nativescript\firebase\firebase.android.js:24:0) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.component.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:238:80) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:397:72) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:33:73) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at __webpack_exec__(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8119:39) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:189) System.err: at __webpack_require__.X(file: src\webpack:\games-app\webpack\runtime\startup entrypoint:6:0) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:47) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8125:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'ads' of undefined System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743) System.err: at android.app.ActivityThread.-wrap1(Unknown Source:0) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:164) System.err: at android.app.ActivityThread.main(ActivityThread.java:6494) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) System.err: Caused by: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'ads' of undefined System.err: File: (file: src\webpack:\games-app\webpack\bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src\webpack:\games-app\node_modules\@nativescript\firebase\firebase.android.js:24:0) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.component.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:238:80) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:397:72) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:33:73) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at __webpack_exec__(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8119:39) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:189) System.err: at __webpack_require__.X(file: src\webpack:\games-app\webpack\runtime\startup entrypoint:6:0) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:47) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8125:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'ads' of undefined System.err: at com.tns.Runtime.runModule(Native Method) System.err: at com.tns.Runtime.runModule(Runtime.java:689) System.err: at com.tns.Runtime.run(Runtime.java:681) System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) System.err: ... 8 more
I have been able to resolve the errors. I was setting up firebase in the wrong spot. Moving the setup to the module has worked just fine. All good now!
My app was running fine. I now have this problem upon installing @nativescript/firebase
System.err: An uncaught Exception occurred on "main" thread. System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'ads' of undefined System.err: File: (file: src\webpack:\games-app\webpack\bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src\webpack:\games-app\node_modules\@nativescript\firebase\firebase.android.js:24:0) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.component.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:238:80) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:397:72) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:33:73) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at __webpack_exec__(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8119:39) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:189) System.err: at __webpack_require__.X(file: src\webpack:\games-app\webpack\runtime\startup entrypoint:6:0) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:47) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8125:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'ads' of undefined System.err: System.err: StackTrace: System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'ads' of undefined System.err: File: (file: src\webpack:\games-app\webpack\bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src\webpack:\games-app\node_modules\@nativescript\firebase\firebase.android.js:24:0) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.component.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:238:80) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:397:72) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:33:73) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at __webpack_exec__(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8119:39) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:189) System.err: at __webpack_require__.X(file: src\webpack:\games-app\webpack\runtime\startup entrypoint:6:0) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:47) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8125:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'ads' of undefined System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743) System.err: at android.app.ActivityThread.-wrap1(Unknown Source:0) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:164) System.err: at android.app.ActivityThread.main(ActivityThread.java:6494) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) System.err: Caused by: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'ads' of undefined System.err: File: (file: src\webpack:\games-app\webpack\bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src\webpack:\games-app\node_modules\@nativescript\firebase\firebase.android.js:24:0) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.component.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:238:80) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:397:72) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at fn(file: src\webpack:\games-app\webpack\runtime\hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:33:73) System.err: at __webpack_require__(file: src\webpack:\games-app\webpack\bootstrap:24:0) System.err: at __webpack_exec__(file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8119:39) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:189) System.err: at __webpack_require__.X(file: src\webpack:\games-app\webpack\runtime\startup entrypoint:6:0) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8120:47) System.err: at (file:///data/data/com.gamesapp.android.app/files/app/bundle.js:8125:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'ads' of undefined System.err: at com.tns.Runtime.runModule(Native Method) System.err: at com.tns.Runtime.runModule(Runtime.java:689) System.err: at com.tns.Runtime.run(Runtime.java:681) System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) System.err: ... 8 more
package.json
"dependencies": { "@angular/animations": "^12.2.0", "@angular/common": "^12.2.0", "@angular/compiler": "^12.2.0", "@angular/core": "^12.2.0", "@angular/forms": "^12.2.0", "@angular/platform-browser": "^12.2.0", "@angular/platform-browser-dynamic": "^12.2.0", "@angular/router": "^12.2.0", "@nativescript-community/ui-image": "^4.0.27", "@nativescript/angular": "~12.2.0", "@nativescript/core": "^8.1.1", "@nativescript/firebase": "^11.1.3", "@nativescript/social-share": "^2.0.4", "@nativescript/theme": "~3.0.1", "@types/faker": "^5.5.8", "@types/lodash": "~4.14.172", "faker": "^5.5.3", "lodash": "~4.17.21", "nativescript-intl": "^4.0.2", "nativescript-ui-listview": "^10.0.0", "nativescript-ui-sidedrawer": "^10.0.1", "reflect-metadata": "~0.1.13", "rxjs": "~7.1.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular/compiler-cli": "^12.2.0", "@nativescript/android": "8.1.1", "@nativescript/ios": "8.1.0", "@nativescript/schematics": "^11.2.0", "@nativescript/types": "^8.1.1", "@nativescript/webpack": "^5.0.0", "@ngtools/webpack": "^12.2.5", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", "react-refresh": "^0.9.0", "typescript": "~4.3.5" },
app.component.ts
import { firebase } from "@nativescript/firebase"; ngOnInit(): void { firebase .init({ // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs. }) .then( () => { console.log("firebase.init done"); }, error => { console.log(
firebase.init error: ${error}); } );}
Any ideas to overcome this error? I have tried both @nativescript/firebase v11.1.2 and 11.1.3.