I tried to set up a Firebase app in Android in kotlin ,
I have done this before and everything worked correctly before. This time though the problem was that i downloaded the google_services.json before creating a database.
After downloading the services.json file i created a realtime database and re downloaded the google_services.json file. But i cannot write to the database now
i tried to write this code
println(FirebaseApp.getInstance().options.toString())
the output of which is as follows
I/System.out: FirebaseOptions{applicationId=1:1015286121155:android:1cced0097502849b051876, apiKey=AIzaSyDznjwsm1NGIn0bIcZewDm0Addqu_QDK4I, databaseUrl=null, gcmSenderId=1015286121155, storageBucket=standup-slack.appspot.com, projectId=standup-slack}
Also tried to do the following,
database.getReference("test").child("askljalsd").setValue("Hello, World!").addOnCompleteListener {
when{
it.isCanceled-> println("it is isCanceled ")
it.isSuccessful-> println("it is isSuccessful")
it.isComplete-> println("it is isComplete")
}
}
None of the cases run when the above code is executed.
I am unable to debug why my firebase database url is null even when i have updated the google_services.json file
google-services.jsonfile correctly to the app? The debug output you're showing seems to indicate otherwise, as it shows thatdatabaseUrlis stillnullwhich shouldn't be the case forgoogle-services.jsonthat was downloaded after creating the database in the Firebase console.. - Frank van Puffelengoogle-services.jsonbecause when i open it in the editor i can see a key withdatabse_urlin it and it points to the correct path - Neo Wakeup