0

I get this problem when I generate the APK it was shown in the installing from the android studio but it disappears later This problem shown in all classes I have its objects in the firebase

I set the setter/getter and I read a lot of question but it still

public class User {

//This is the key of users child in the firebase
    static final String USER_CHILD = "Users";
    private String ID;
    private String name;
    private String email;

    public User() {}

    public User(String ID, String name, String email) {
        this.ID = ID;
        this.name = name;
        this.email = email;
    }

    @NonNull
    @Override
    public String toString() {
        return getID();
    }

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}

EDIT FIREBASE JSON TREE

{
  "ali" : {
    "email" : "any4@gmail.com",
    "id" : "ali",
    "name" : "mohammed ali"
  },
  "ali3" : {
    "email" : "any3@gmail.com",
    "id" : "ali3",
    "name" : "hhhhhjjj"
  },
  "mo_dev" : {
    "email" : "any2@gmail.com",
    "id" : "mo_dev",
    "name" : "mokah"
  },
  "mok" : {
    "email" : "any1@gmail.com",
    "id" : "mok",
    "name" : "mohammed"
  }
}
Mohammed
  • 55
  • 1
  • 8

1 Answers1

0

In your class try putting this first above the class:

@Keep

You can also add this to your proguard-rules.pro file:

-keep class com.example.yourapp.YourClass

where YourClass is the name of your java object class that is stored to Firebase.

Yash
  • 3,438
  • 2
  • 17
  • 33