Firebase Database Points to Wrong Database Url

Android - Firebase realtime database reference pointing to invalid url

When you are using the following line of code:

Log.i("rootDatabase", String.valueOf(rootDatabase));

You are passing to the valueOf() method the rootDatabase object, which is of type FirebaseDatabase. So you are only printing the String representation of the object, which is actually a memory address. However, when you are using this line:

Log.i("rootReference", String.valueOf(rootReference));

You are passing a different object to the valueOf() method. This time the object is of type DatabaseReference. Now the String representation of the object is actually a URL that points to your project.

Is there any way that I can either change the location of the firebase database to no be in the Europe-west region

Once you set the location, this cannot be changed. If you need another location, you need to create another project, set the location to be in another region than the Europe-west region, download the JSON file again and you'll be good to go.

Wrong URL for Firebase database in AndroidStudio

Looks like your Realtime Database instance is in the europe-west1 region.

As per this note in the documentation, "to get a reference to a database other than a us-central1 default database, you must pass the database URL to getInstance()"

Try explicitly using:

FirebaseDatabase database = FirebaseDatabase.getInstance(https://<databaseName><region>.firebasedatabase.app);

FIREBASE FATAL ERROR: Can't determine Firebase Database URL

Your configuration object (the one you pass to initializeApp) is missing a databaseURL property. It's unclear from your question why it's missing or what you may have done to omit it, but that's what you need. You can get the string value for that property in the Firebase console for your app under "project settings".

How do I fix this Firebase RunTime DB error where the entry into the database and authentication details are created but all the fields are null?

From the comments it sounds like createUserWithEmailAndPassword fails. When that happens, the task actually contains an exception with more information about the failure - but you're not handling that.

A better way to handle task failure is:

public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
...
}
else{
Toast.makeText(Register.this,"Failed to Register User", Toast.LENGTH_LONG).show();
Log.e("Create user", "Failed to create user", task.getException());
}
progressBar.setVisibility(ViewStub.GONE);
}

With this, the cause of the task failure will show up in your logcat output.

Firebase Database connection was forcefully killed by the server

If you updated google-services.json file.

-> Build / Clear Project
-> Rebuild Project

Firebase Realtime Database url is null

In the Android Studio Project, Deleting the app > build folder and clearing the gradle cache made it recognize the new google_services.json



Related Topics



Leave a reply



Submit