Arcore-android-sdk: Cloud Anchors: Firebase Database error: Permission denied

Created on 22 Jun 2018  路  5Comments  路  Source: google-ar/arcore-android-sdk

I'm trying the Cloud Anchors sample application and I'm setting it up as described here; however, when I run the app and I tap the "host" button, I get this exception:

06-22 17:49:12.798 1267-1292/com.google.ar.core.examples.java.cloudanchor W/SyncTree: Listen at /last_room_code failed: DatabaseError: Permission denied
06-22 17:49:12.801 1267-1292/com.google.ar.core.examples.java.cloudanchor W/RepoOperation: Transaction at /last_room_code failed: DatabaseError: Permission denied
06-22 17:49:12.804 1267-1267/com.google.ar.core.examples.java.cloudanchor W/CloudAnchorActivity: A Firebase database error happened.
    com.google.firebase.database.DatabaseException: Firebase Database error: Permission denied
        at com.google.firebase.database.DatabaseError.toException(Unknown Source:21)
        at com.google.ar.core.examples.java.cloudanchor.CloudAnchorActivity$RoomCodeAndCloudAnchorIdListener.onError(CloudAnchorActivity.java:552)
        at com.google.ar.core.examples.java.cloudanchor.FirebaseManager$1.onComplete(FirebaseManager.java:112)
        at com.google.android.gms.internal.zzehj.run(Unknown Source:11)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6938)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)`

Am I doing wrong something with API keys and App IDs, or there is something missing about this database? If I look online for this exception, I find references to the databases rules (for instance, this). I tried adding a Cloud Firestore Database in the Firebase console, using that set of rules, but the exception didn't change.

cloud anchors documentation bug

Most helpful comment

The devsite is still not updated with this instruction

All 5 comments

Ok, I found it. Basically I set the Firebase Database using Cloud Firestore, and it was not working. I set it to Realtime Database (as hinted on issue #369 ) and I used the database rules as suggested in the already linked Stackoverflow Solution.

However, I might be wrong but it seems to me that nowhere in the Cloud Anchors quickstart is mentioned about the need to create the Firebase Realtime Database.

I've asked our Cloud Anchors expert to respond to this.

Thanks for pointing this out, @ocramot. I'll get our docs team to update the devsite with more detailed instructions for setting up the Firebase Realtime database.

When you are working with real time database integrate with firebase then you have to add the read and the write permissions by yourself.(This is hectic one)

You need to set the rules by yourself
{ "rules": { ".read": "true", ".write": "true" } }

like this or you can go through the video for more details

https://youtu.be/b2SBkUWLKSc

The devsite is still not updated with this instruction

Was this page helpful?
0 / 5 - 0 ratings