Reputation: 736
I have a usermodel class with different fields. Firebase has a set value method where we can pass the object and it will automatically store the value of the object with respective usermodel's items name as a key of node. My app is working fine on debug app. But when i try to set value using the release app it saves the data but the key name is not same it is c,d,i etc.
I am initilizing the model
userModel = new UserModel(mUser.getDisplayName(), mUser.getPhotoUrl().toString(), inputUname, url,
ratings, questions, instanceIdResult.getToken(), noti_settings);
my model class
public class UserModel implements Serializable {
private String uName,uDp,userName,profileLink;
private ArrayList<RatingModel> ratings;
private ArrayList<QuestionModel> questions;
private String token;
private NotificationModel noti_settings;
public UserModel(String uName, String uDp, String userName) {
this.uName = uName;
this.uDp = uDp;
this.userName = userName;
}
public UserModel(String uName, String uDp, String userName, String profileLink,
ArrayList<RatingModel> ratings, ArrayList<QuestionModel> questions, String token) {
this.uName = uName;
this.uDp = uDp;
this.userName = userName;
this.profileLink = profileLink;
this.ratings = ratings;
this.questions = questions;
this.token = token;
}
public UserModel(String uName, String uDp, String userName, String profileLink,
ArrayList<RatingModel> ratings, ArrayList<QuestionModel> questions, String token, NotificationModel
noti_settings) {
this.uName = uName;
this.uDp = uDp;
this.userName = userName;
this.profileLink = profileLink;
this.ratings = ratings;
this.questions = questions;
this.token = token;
this.noti_settings = noti_settings;
}
public NotificationModel getNoti_settings() {
return noti_settings;
}
public void setNoti_settings(NotificationModel noti_settings) {
this.noti_settings = noti_settings;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public ArrayList<QuestionModel> getQuestions() {
return questions;
}
public void setQuestions(ArrayList<QuestionModel> questions) {
this.questions = questions;
}
public ArrayList<RatingModel> getRatings() {
return ratings;
}
public void setRatings(ArrayList<RatingModel> ratings) {
this.ratings = ratings;
}
public String getProfileLink() {
return profileLink;
}
public void setProfileLink(String profileLink) {
this.profileLink = profileLink;
}
public String getuName() {
return uName;
}
public void setuName(String uName) {
this.uName = uName;
}
public String getuDp() {
return uDp;
}
public void setuDp(String uDp) {
this.uDp = uDp;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
Setting value from released app
Setting value from debug app
Upvotes: 0
Views: 129
Reputation: 795
I think that's because of proguard use in release version of app, use proguard rules to keep model class.
-keep class com.xyz.data.models.** { *; } //path to package containing your model class
Hope this will help!!
Upvotes: 2