EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

Error on initialize #1747

Open PabloPG opened 3 years ago

PabloPG commented 3 years ago

After starting a new project with nativescript 7 + angular, I installed nativescript-plugin-firebase.

When I try to start firebase, I get this error:

Successfully synced application br.com.pegabike on device emulator-5554.
JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
JS: Error in firebase.init: Error: com.google.firebase.database.DatabaseException: Failed to get FirebaseDatabase instance: Specify DatabaseURL within FirebaseApp or from your getInstance() call.
JS: Angular is running in development mode. Call enableProdMode() to enable production mode.
JS: ERROR Error: Uncaught (in promise): Error: com.google.firebase.database.DatabaseException: Failed to get FirebaseDatabase instance: Specify DatabaseURL within FirebaseApp or from your getInstance() call.
JS: runInit(file: node_modules\@nativescript\firebase\firebase.android.js:322:24)
JS:     at (file: node_modules\@nativescript\firebase\firebase.android.js:371:0)
JS:     at ZoneAwarePromise(file: node_modules\@nativescript\zone-js\zone-nativescript.js:902:0)
JS:     at push.../node_modules/@nativescript/firebase/firebase.js._firebase_common__WEBPACK_IMPORTED_MODULE_2__.firebase.init(file: node_modules\@nativescript\firebase\firebase.android.js:298:0)
JS:     at ngOnInit(file: src\app\app.component.ts:28:11)
JS:     at callHook(file: node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:2486:0)
JS:     at callHooks(file: node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:2456:0)
JS:     at executeInitAndCheckHooks(file: node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:2408:0)
JS:     at refreshView(file: node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:9158:0)
JS:     at ...
Falu-G commented 3 years ago

I'm having the same issue @EddyVerbruggen
Kindy assist

Medscience commented 3 years ago

I have the same issue, working with nativeScript 7.2 + angular. It works on IOS but it fails on Android. I'm using my own appId so I replace the firebaseBucket. I get this error

JS: HMR: Hot Module Replacement Enabled. Waiting for signal. JS: Error in firebase.init: Error: com.google.firebase.database.DatabaseException: Failed to get FirebaseDatabase instanc e: Specify DatabaseURL within FirebaseApp or from your getInstance() call. JS: Angular is running in development mode. Call enableProdMode() to enable production mode. JS: firebase.init error: Error: com.google.firebase.database.DatabaseException: Failed to get FirebaseDatabase instance: Specify DatabaseURL within FirebaseApp or from your getInstance() call. JS: ERROR Error: Uncaught (in promise): Run init() first!

Medscience commented 3 years ago

I resolved the issue - 1- Download again the google-services.json from Project Settings. My mistake was to enable the database after I have downloaded google-services.json. Just download it again from the Firebase site. 2- Run tns platform clean android 3- Run tns run android