Nativescript-plugin-firebase: firebase.init error: TypeError: Cannot read property 'getInstance' of undefined

Created on 29 Sep 2018  路  7Comments  路  Source: EddyVerbruggen/nativescript-plugin-firebase

i try to use firebase plugin in my nativescript core(not angular) project
and i noticed that reference.d.ts file not exist in my project to put this line
""
i try to install and reinstall the plugin and remove /add platform android without any changes and i stuck in this step when i put the following code

firebase.init({
// Optionally pass in properties for database, authentication and cloud messaging,
// see their respective docs.
}).then(
instance => {
console.log("firebase.init done");
},
error => {
console.log(firebase.init error: ${error});
}
);

any suggestions please

Android Authentication bug

Most helpful comment

This has been broken since 6.8.1 (in #904) for plugin users on Android, with "authentication": false in firebase.nativescript.json. I'll fix this today in 7.1.2.

All 7 comments

i have the same problem.
i install my plugin normally and i have "firebase.nativescript.json" file created at my root by installer script.
any help please
i am using nativescript angular 6.1 and nativescript plugin firebase 7.1.1
i am testing this with android emulator.

Same problem here, I麓m also using nativescript angular 6.1 and nativescript plugin firebase 7.1.1...

I tried removing the platform/android, reinstalling the plug-in without success.

I have the same problem using NativeScript 4.2 without Angular and nativescript-plugin-firebase 7.1.1.
No success after removing platform android, re-installing the plugin and building the app with tns run android --syncAllFiles.

Share a repo that easily shows the issue please.

PluginFireBaseIssue.zip

Just open the app, tap the button to call the init method and you see the message

TypeError: Cannot read property 'getInstance' of undefined

Thanks, @felix-idf, that really helps. I don't think I've tested recent versions with this firebase.nativescript.json config (only using_android and messaging are true):

{
    "external_push_client_only": false,
    "using_ios": false,
    "using_android": true,
    "firestore": false,
    "realtimedb": false,
    "authentication": false,
    "remote_config": false,
    "messaging": true,
    "crashlytics": false,
    "crash_reporting": false,
    "storage": false,
    "functions": false,
    "facebook_auth": false,
    "google_auth": false,
    "admob": false,
    "invites": false,
    "dynamic_links": false,
    "ml_kit": false
}

Looking into it.

This has been broken since 6.8.1 (in #904) for plugin users on Android, with "authentication": false in firebase.nativescript.json. I'll fix this today in 7.1.2.

Was this page helpful?
0 / 5 - 0 ratings