Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

TypeError: Cannot read property 'messaging' of undefined #271

Closed
ghost opened this issue Jan 28, 2017 · 3 comments
Closed

TypeError: Cannot read property 'messaging' of undefined #271

ghost opened this issue Jan 28, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 28, 2017

I've been trying to get this plugin working on android, but it keeps crashing showing this error:

An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: 

Error calling module function 

Error calling module function 

TypeError: Cannot read property 'messaging' of undefined
File: "/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js, line: 17, column: 32

StackTrace: 
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 17, column: 33
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 50, column: 3
	Frame: function:'require', file:'', line: 1, column: 266
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/main.js', line: 9, column: 16
	Frame: function:'require', file:'', line: 1, column: 266


TypeError: Cannot read property 'messaging' of undefined
File: "<unknown>, line: 1, column: 265

StackTrace: 
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 17, column: 33
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 50, column: 3
	Frame: function:'require', file:'', line: 1, column: 266
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/main.js', line: 9, column: 16
	Frame: function:'require', file:'', line: 1, column: 266


TypeError: Cannot read property 'messaging' of undefined
File: "<unknown>, line: 1, column: 265

StackTrace: 
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 17, column: 33
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 50, column: 3
	Frame: function:'require', file:'', line: 1, column: 266
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/main.js', line: 9, column: 16
	Frame: function:'require', file:'', line: 1, column: 266


	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4760)
	at android.app.ActivityThread.access$1500(ActivityThread.java:160)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5466)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: com.tns.NativeScriptException: 

Error calling module function 

Error calling module function 

TypeError: Cannot read property 'messaging' of undefined
File: "/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js, line: 17, column: 32

StackTrace: 
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 17, column: 33
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 50, column: 3
	Frame: function:'require', file:'', line: 1, column: 266
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/main.js', line: 9, column: 16
	Frame: function:'require', file:'', line: 1, column: 266


TypeError: Cannot read property 'messaging' of undefined
File: "<unknown>, line: 1, column: 265

StackTrace: 
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 17, column: 33
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 50, column: 3
	Frame: function:'require', file:'', line: 1, column: 266
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/main.js', line: 9, column: 16
	Frame: function:'require', file:'', line: 1, column: 266


TypeError: Cannot read property 'messaging' of undefined
File: "<unknown>, line: 1, column: 265

StackTrace: 
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 17, column: 33
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 50, column: 3
	Frame: function:'require', file:'', line: 1, column: 266
	Frame: function:'', file:'/data/data/com.boutica.firebase/files/app/main.js', line: 9, column: 16
	Frame: function:'require', file:'', line: 1, column: 266


	at com.tns.Runtime.runModule(Native Method)
	at com.tns.Runtime.runModule(Runtime.java:514)
	at com.tns.Runtime.run(Runtime.java:509)
	at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1015)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4757)
	... 9 more

I've tried modifying app.gradle like this

...
defaultConfig {
  ...
  multiDexEnabled true
}
dexOptions {
  javaMaxHeapSize "4g"
}

Really appreciate it if you can help me solve this, thanks ;)

@EddyVerbruggen
Copy link
Owner

It means the Firebase SDK has not yet been loaded. Are you running this in livesync mode? If so do a regular tns build android / tns run android and livesync again afterwards.

@ghost
Copy link
Author

ghost commented Jan 31, 2017

It's fixed now. I've run both tns build android and tns run android before, but that doesn't seem to be the problem. I think it's the nativescript.id not matching the bundle id - It worked when I created a new project with matching IDs

@ghost ghost closed this as completed Jan 31, 2017
@abozanona
Copy link

I'm having this issue too, I'm building my application on cloud.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants