I recently created a new NativeScript 8.2.3 project to do a redesign of an older existing project which was running on NativeScript 8.2.2.
I have installed the plugin via npm i @nativescript/firebase and added the plugin to the project via tns plugin add @nativescript/firebase. After adding the google-services.json to my App_Resources I have implemented the firebase.init() function to my app.component.ts like this:
but after running ns debug android I get the following StackTrace:
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:/mtbappmobile/webpack/bootstrap:27:0)
System.err:
System.err: StackTrace:
System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src/webpack:/mtbappmobile/node_modules/@nativescript/firebase/firebase.android.js:24:0)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/app/app.component.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:174:80)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/app/app.module.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:206:72)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/main.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:14:73)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at webpack_exec(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:274:39)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:275:189)
System.err: at webpack_require.X(file: src/webpack:/mtbappmobile/webpack/runtime/startup entrypoint:6:0)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:275:47)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:280: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:/mtbappmobile/webpack/bootstrap:27:0)
System.err:
System.err: StackTrace:
System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src/webpack:/mtbappmobile/node_modules/@nativescript/firebase/firebase.android.js:24:0)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/app/app.component.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:174:80)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/app/app.module.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:206:72)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/main.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:14:73)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at webpack_exec(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:274:39)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:275:189)
System.err: at webpack_require.X(file: src/webpack:/mtbappmobile/webpack/runtime/startup entrypoint:6:0)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:275:47)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:280: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:5876)
System.err: at android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
System.err: at android.os.Looper.loop(Looper.java:193)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6669)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
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:/mtbappmobile/webpack/bootstrap:27:0)
System.err:
System.err: StackTrace:
System.err: ./node_modules/@nativescript/firebase/firebase.android.js(file: src/webpack:/mtbappmobile/node_modules/@nativescript/firebase/firebase.android.js:24:0)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/app/app.component.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:174:80)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/app/app.module.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:206:72)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at fn(file: src/webpack:/mtbappmobile/webpack/runtime/hot module replacement:62:0)
System.err: at ./src/main.ts(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:14:73)
System.err: at webpack_require(file: src/webpack:/mtbappmobile/webpack/bootstrap:24:0)
System.err: at webpack_exec(file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:274:39)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:275:189)
System.err: at webpack_require.X(file: src/webpack:/mtbappmobile/webpack/runtime/startup entrypoint:6:0)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:275:47)
System.err: at (file:///data/data/com.maxtoolbox.vrsta/files/app/bundle.js:280: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:1154)
System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err: ... 8 more
The app is running fine when I remove the firebase.init()function. Do you have an idea what causes this issue and how to resolve it?
I recently created a new NativeScript 8.2.3 project to do a redesign of an older existing project which was running on NativeScript 8.2.2.
I have installed the plugin via
npm i @nativescript/firebase
and added the plugin to the project viatns plugin add @nativescript/firebase
. After adding the google-services.json to my App_Resources I have implemented thefirebase.init()
function to my app.component.ts like this:but after running ns debug android I get the following StackTrace:
The app is running fine when I remove the
firebase.init()
function. Do you have an idea what causes this issue and how to resolve it?here is my package.json: