1
votes

I'm calling data from a Firebase Realtime Database into Android, and I get the following error: "W/SyncTree: Listen at /Datas failed: DatabaseError: Permission denied"

My rules are set to:

{"rules": {
".read": "auth == null",
".write": false}}

Changing "auth == null" to true also throws the same permission error.

I do not want to give user permission to write the db, just read.

I have already:
Connected the app to Firebase
Set dependencies
Written to the database

Any ideas?
Thanks

3
read = true works - erluxman
Tried read = true. I get the same Permission denied error - map.apps
Can you add the code you are using to write/read? - André Kool
It's impossible to say anything conclusive without seeing the minimal code that produces this error. - Frank van Puffelen

3 Answers

2
votes

Change the rules to :

{
  "rules": {
    ".read": true,
    ".write": false
  }
}
0
votes

The google-services.json file needed to be downloaded and added to the app root directory. The error "DatabaseError: Permission denied" no longer appears.

0
votes

Fist try with change rules of read / write permission if it's still not working then try to clean and rebuild project. In my case i added another project google-service.json due to project change and this error prompt whenever try to write something in database then i search previous DB url in project and that URL had in auto generated files then I clean and rebuild project and it's working fine now .