Hello,
As a proof of concept I tested the project at https://github.com/EddyVerbruggen/ns-vue-firebase-test, and it works :)
But if I update to the 6.X.X version of the plugin, I get the following error:
TypeError: Cannot read property 'firebase' of undefined
File: "file:///data/data/com.ladeezfirstmedia.elocute/files/app/app.js, line: 1, column: 337380
I can't understand what's wrong. Is it possible to have some more debugging informations?
Thanks
I have similar issue.
System.err:
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
System.err: at android.app.ActivityThread.-wrap12(ActivityThread.java)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
System.err: at android.os.Looper.loop(Looper.java:154)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6119)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
System.err: Caused by: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: TypeError: Cannot read property 'firebase' of undefined
System.err: File: "file:///data/data/bat.pm.application/files/app/app.js, line: 1, column: 155066
System.err:
System.err: StackTrace:
System.err: Frame: function:'i', file:'file:///data/data/bat.pm.application/files/app/app.js', line: 1, column: 155067
System.err: Frame: function:'Observable.notify', file:'file:///data/data/bat.pm.application/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 103, column: 23
System.err: Frame: function:'ActivityCallbacksImplementation.notifyLaunch', file:'file:///data/data/bat.pm.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 621, column: 21
System.err: Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/bat.pm.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 585, column: 29
System.err: Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/bat.pm.application/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err:
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:983)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:970)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:954)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:946)
System.err: at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:18)
System.err: at android.app.Activity.performCreate(Activity.java:6679)
System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
System.err: ... 9 more
ActivityManager: Process bat.pm.application (pid 4205) has died
ActivityManager: cleanUpApplicationRecord -- 4205
Btw, could the author write the document for NativeScript-Vue in more details? I've tried so hard, it seems more complex than 4 lines instruction that the doc gives me.
````
Using Vue?
If you're using this template: vue-cli-template, then copy firebase.nativescript.json to the template folder. You could also symlink it: firebase.nativescript.json -> template/firebase.nativescript.json.
And also, require the plugin before Vue.start runs (probably in main.js), but run firebase.init() afterwards (although it may work before). You could wrap it in a timeout to make sure.
````
I updated my comment, indeed I messed up a bit during the tests :), but the fact remains that the plugins works correctly with the example until version 5.3.1, then starting with 6.0.1 it gives the reported error.
I'm trying to understand what's changed between the versions.
@EddyVerbruggen, maybe you could provide some insight?
This is the changelog between those 2 versions: https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/5.3.1...6.0.1
Thank you @EddyVerbruggen, but unfortunately I'm a total beginner to nativescript and mobile development. I checked out the project, but I can't succeed in using this local version of the node module instead of the npm's one:
I tried with
npm install /absolute/local/path/nativescript-firebase-plugin/src
without touching the import statement:
import firebase from "nativescript-plugin-firebase";
and, from a node's point of view it works (in the sense that the installation goes fine and I can see the nodescript-firebase-plugin between my node_modules). I also updated _template/package.json_ . but when I build the application I get the error:
ERROR in ./src/main.js
Module not found: Error: Can't resolve 'nativescript-plugin-firebase' in <path/to/my/src/directory>
I also tryed with npm link, same problem. I tested with a stupid module I created myself and everything was working. So I don't know if there's something peculiar going on.... :/
The fact is that I cannot simply understand what is the problem by looking at the code of the plugin, the idea was to test around and see which commit created the problem (if possible) and then see if it was within my skills to fix it :)
I can add that the plugin doesn't work if I use the vue-cli-template.
Using the nativescript-vue-template, it works correctly.
Stupid me. I totally missed the part of copying firebase.nativescript.json to the template folder
@vratojr i'm also using the vue-cli-template (the next branch is now merged to the master) but cannot seem to get this firebase plugin working correctly for iOS (android is fine). perhaps i am also missing this template folder step.. in fact, a template folder was never created for me, just a root folder (project name) and app folder inside that. where do you have a template folder?
My template folder is at the project's root: same level of src and dist.
If you have an 'app' folder you are not using the vue-cli-template I think, but the other one. Beware that there are 2 templates for vue.
@EddyVerbruggen I am having this issue using firebase with NS-Vue
System.err: TypeError: Cannot read property 'FirebaseAnalytics' of undefined
System.err: File: "file:///data/data/org.nativescript.application/files/app/app.js, line: 52594, column: 41
System.err:
System.err: StackTrace:
System.err: Frame: function:'runInit', file:'file:///data/data/org.nativescript.application/files/app/app.js', line: 52594, column: 42
System.err: Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 103, column: 23
System.err: Frame: function:'ActivityCallbacksImplementation.notifyLaunch', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 621, column: 21
System.err: Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 585, column: 29
System.err: Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err:
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
System.err: at android.app.ActivityThread.-wrap12(ActivityThread.java)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
System.err: at android.os.Handler.dispatchMessage(Handler.java:110)
System.err: at android.os.Looper.loop(Looper.java:203)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6284)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1094)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
System.err: Caused by: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: TypeError: Cannot read property 'FirebaseAnalytics' of undefined
System.err: File: "file:///data/data/org.nativescript.application/files/app/app.js, line: 52594, column: 41
System.err:
System.err: StackTrace:
System.err: Frame: function:'runInit', file:'file:///data/data/org.nativescript.application/files/app/app.js', line: 52594, column: 42
System.err: Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 103, column: 23
System.err: Frame: function:'ActivityCallbacksImplementation.notifyLaunch', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 621, column: 21
System.err: Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 585, column: 29
System.err: Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err:
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err: at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:13)
System.err: at android.app.Activity.performCreate(Activity.java:6734)
System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
System.err: ... 9 more
ActivityManager: Process org.nativescript.application (pid 29718) has died
ActivityManager: handleAppDiedLocked: app = ProcessRecord{fe14d4e 29718:org.nativescript.application/u0a559}, app.pid = 29718
ActivityManager: cleanUpApplicationRecord -- 29718
Cannot read property 'FirebaseAnalytics' of undefined
Same here
Same here! App created using SideSick + VueJs
```java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onCreate failed
TypeError: Cannot read property 'FirebaseAnalytics' of undefined
File: "file:///data/data/org.nativescript.preview/files/app/vendor.js, line: 1341, column: 36
StackTrace:
Frame: function:'runInit', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 1341, column: 37
Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 110, column: 23
Frame: function:'notifyLaunch', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 944, column: 17
Frame: function:'ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 877, column: 28
Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 751, column: 14
Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2955)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: com.tns.NativeScriptException:
Calling js method onCreate failed```
@roberto910907 / @farukzahra Can you share a repo and steps so I can reproduce this?
Most helpful comment
@EddyVerbruggen I am having this issue using firebase with NS-Vue
System.err: TypeError: Cannot read property 'FirebaseAnalytics' of undefined
System.err: File: "file:///data/data/org.nativescript.application/files/app/app.js, line: 52594, column: 41
System.err:
System.err: StackTrace:
System.err: Frame: function:'runInit', file:'file:///data/data/org.nativescript.application/files/app/app.js', line: 52594, column: 42
System.err: Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 103, column: 23
System.err: Frame: function:'ActivityCallbacksImplementation.notifyLaunch', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 621, column: 21
System.err: Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 585, column: 29
System.err: Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err:
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
System.err: at android.app.ActivityThread.-wrap12(ActivityThread.java)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
System.err: at android.os.Handler.dispatchMessage(Handler.java:110)
System.err: at android.os.Looper.loop(Looper.java:203)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6284)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1094)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
System.err: Caused by: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: TypeError: Cannot read property 'FirebaseAnalytics' of undefined
System.err: File: "file:///data/data/org.nativescript.application/files/app/app.js, line: 52594, column: 41
System.err:
System.err: StackTrace:
System.err: Frame: function:'runInit', file:'file:///data/data/org.nativescript.application/files/app/app.js', line: 52594, column: 42
System.err: Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 103, column: 23
System.err: Frame: function:'ActivityCallbacksImplementation.notifyLaunch', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 621, column: 21
System.err: Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 585, column: 29
System.err: Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.application/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err:
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err: at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:13)
System.err: at android.app.Activity.performCreate(Activity.java:6734)
System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
System.err: ... 9 more
ActivityManager: Process org.nativescript.application (pid 29718) has died
ActivityManager: handleAppDiedLocked: app = ProcessRecord{fe14d4e 29718:org.nativescript.application/u0a559}, app.pid = 29718
ActivityManager: cleanUpApplicationRecord -- 29718