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

Cannot read property firebase of undefined error in Windows 7 Genymotion #57

Closed
vzhen opened this issue Jun 16, 2016 · 6 comments
Closed

Comments

@vzhen
Copy link

vzhen commented Jun 16, 2016

Here is my setup.

Enviroment

Windows 7 64bits
Genymotion android 4.4

Genymotion Google play service setup

  1. Drag Genymotion-ARM-Translation_v1.1 to install
  2. adb reboot
  3. Drag gapps-kk-20140606-signed to install
  4. adb reboot
  5. login google account
  6. update all google apps including google play services

Create new Nativescript app

  1. tns create my-app
  2. tns livesync android  --watch to check if {N} working.

Install nativescript-plugin-firebase@3.0.1

  • Download google-services.json from firebase console and move it to platform/android
  • tns plugin add nativescript-plugin-firebase
  • add applicationId “org.nativescript.myapp” and “multiDexEnabled true” in app/App_Resources/Android/app.gradle
defaultConfig { 
  generatedDensities = [] 
  applicationId “org.nativescript.myapp”
  multiDexEnabled true
}
  • add classpath “com.google.gms:google-services:3.0.0” in platforms/android/build.gradle
dependencies {
 classpath “com.android.tools.build:gradle:1.5.0”
 classpath “com.google.gms:google-services:3.0.0”
 }
  • In same file, platforms/android/build.gradle add apply plugin: “com.google.gms.google-services” at very bottom.
  • add these 2 lines in app/references.d.ts
/// <reference path=”../node_modules/nativescript-plugin-firebase/firebase.d.ts” />
/// <reference path=”../node_modules/nativescript-plugin-firebase/firebase-common.d.ts” />
  • add firebase.init in app.js
var application = require(“application”);
var firebase = require(“nativescript-plugin-firebase”);
firebase.init({
   persist: true // Allow disk persistence. Default false.
}).then(function (instance) {
   console.log(“firebase.init done”);
},function (error) {
 console.log(“firebase.init error: “ + error);
});
application.start({ moduleName: “main-page” });
  • tns livesync android  --watch

Ok, app is running but got firebase init error: cannot read property firebase of undefined in cmd.

@EddyVerbruggen
Copy link
Owner

I'm not sure the plugin behaves nicely if you run init before the app itself is completely bootstrapped -- can you move firebase stuff to after application.start?

@vzhen
Copy link
Author

vzhen commented Jun 20, 2016

Tried and same error, i even tested init in another module. By the way, where to check logs file? so i can provide you more info

@vzhen
Copy link
Author

vzhen commented Jun 20, 2016

@EddyVerbruggen i tested it again on version 3.2.0 there is an new error.

capture

@EddyVerbruggen
Copy link
Owner

Did you follow all the steps in the readme, including the 'known issues' section? This is not an easy thing to do so please have patience.

@vzhen
Copy link
Author

vzhen commented Jun 20, 2016

My bad, i got id typo.
Ok, Cannot read property firebase of undefined error fixed. Thanks for that.

but there is a new weird issue, refer to image below. At first, firebase init done but after 2-3 seconds it returns FirebaseApp with name [DEFAULT] doesn't exists and GoogleSinatureVerifire at very bottom (I not sure is it sensitive data so i erase it). The weird thing is, i'm still able to push() to firebase. LOL

Let me know if you want to open this as new issue
capture

@vzhen vzhen closed this as completed Jun 20, 2016
@EddyVerbruggen
Copy link
Owner

No please check the known issues in the readme for that error.

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