Home > Net >  DatabaseException: Failed to get FirebaseDatabase instance: Specify DatabaseURL within FirebaseApp o
DatabaseException: Failed to get FirebaseDatabase instance: Specify DatabaseURL within FirebaseApp o

Time:11-03

I'm just testing if I could try to send data in my firebase database but I'm stuck at fixing this kind of error. "Failed to get to get FirebaseDatabase instance". I have no idea what's happening.

void TryDataSend(){   
   DatabaseReference root = FirebaseDatabase.DefaultInstance.RootReference;
}

CodePudding user response:

To be able to connect to the Firebase database, the FirebaseDatabase object needs to know the URL of that database. It typically will:

  • either read this from the google-services.json (Android)or GoogleService-Info.plist (iOS) file upon startup as documented here,
  • or you can specify the URL in code, passing it toFirebaseDatabase.GetInstance.

The error message seems to indicate that neither of these things happened, so I recommend checking the links and see if you've taken all the steps.

  • Related