I'm having trouble writing to my Firebase database in my simple Android app. I've set my database rules to be public:
{
"rules": {
".read": true,
".write": true
}
}
Created a simple class Message
:
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Message {
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference dbRef = database.getReference();
public String sender;
public String message;
public Message(){}
public Message(String sender, String message) {
this.sender = sender;
this.message = message;
}
}
And set a button to perform the onClick method writeNewMessage
with these being the significant lines of code:
int counter = 0;
public void writeNewMessage(View view) {
counter += 1;
Message messageToWrite = new Message("John", "Simple message: " + counter);
String messageId = String.valueOf(counter);
dbRef.child("users").child(messageId).setValue(messageToWrite);
}
When running, I receive the error:
W/RepoOperation: setValue at /users/1 failed: DatabaseError: Permission denied
I know this question seems simple and likely to have been repeated, but I have yet to find any that asks this problem without having their error be involved in authentication or some other component. The simplicity of the problem is what confuses me the most.
EDIT: I've also found this error as well:
Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor"