title: Can't read or write to the firebase realtime database (android studio)
body: <p>I think I connect to the firebase because I received the message for the terminal which is </p>
  
  <pre><code>I/FirebaseInitProvider: FirebaseApp initialization successful
  </code></pre>
  
  <p>And I think I set the rules correct</p>
  
  <pre><code>{
  "rules": {
      ".read": true,
      ".write": true
    }
  }
  </code></pre>
  
  <p>Here are my read and write codes.</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      // Write a message to the database
      FirebaseDatabase database = FirebaseDatabase.getInstance();
      DatabaseReference myRef = database.getReference("message");
  
      myRef.setValue("Hello, World!");
  
  }
  
  @Override
  protected void onStart() {
      super.onStart();
      // Read from the database
      FirebaseDatabase database = FirebaseDatabase.getInstance();
      DatabaseReference myRef = database.getReference("message");
      myRef.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              // This method is called once with the initial value and again
              // whenever data at this location is updated.
              String value = dataSnapshot.getValue(String.class);
              System.out.println(value);
              Log.d("T", "Value is: " + value);
          }
  
          @Override
          public void onCancelled(DatabaseError error) {
              // Failed to read value
              Log.w("F", "Failed to read value.", error.toException());
          }
      });
  }
  }
  </code></pre>
  
  <p>And a very weird thing, it can print the value, but the data is never get updated in the console.</p>
  
  <p>printed value</p>
  
  <pre><code>I/System.out: Hello, World!
  D/T: Value is: Hello, World!
  </code></pre>
  
  <p>but in the console...<a href="https://i.stack.imgur.com/Fl0er.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fl0er.jpg" alt="enter image description here"></a>  </p>