Nis Villanueva
Nis Villanueva

Reputation: 23

DatabaseException: Failed to get FirebaseDatabase instance: Specify DatabaseURL within FirebaseApp or from your GetInstance() call

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;
}

Upvotes: 1

Views: 1234

Answers (2)

Muhammad Abdullah
Muhammad Abdullah

Reputation: 1

The solution is simple. After creating database on firebase console download the updated configuration files and replace with old configuration files in unity project. Check the image for configuration file

Check the image for configuration file

Upvotes: 0

Frank van Puffelen
Frank van Puffelen

Reputation: 598765

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.

Upvotes: 2

Related Questions