Firebase Set Value Putting Wrong Key On Released App

sum20156

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

enter image description here

Setting value from debug app

enter image description here

Nehal Godhasara

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!!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Firebase showing wrong number of users (as my app isn't released)

putting value in foreign key from primary key

Express server putting out wrong value

How to set key value to spinner list from firebase

Is there any way to set key-value pairs in Firebase Crash Reporting?

How to fix Python putting wrong value in MySQL database

How to set key/value default state for TypeScript React app

Firebase Function writes wrong key to firebase database

how to sum up json keys value in array if by putting condition on key

Clojure: set value as a key

Set value of a key in actions

Set Key and Value in spinner

React Select set wrong value

how to set value to zero of key-value pair object which i got in firebase cloud function(snapshot)

Set value of a child in Firebase

Firebase onDatachange() to set value

How to set the Java default button to react on ENTER key _released_?

GooglePlay - wrong signing key for app bundle

Localytics - Programmatically set app key

How should I set up getter and setter which is key - value type in Firebase Realtime Database?

Usage of equalTo("value","key") in Firebase?

Firebase - Retrieve property value by key

Retrieve Key and Value From Firebase

firebase key value return undefined

Pie chart is showing wrong value for key

Primary key column is incremented by wrong increment value

Angular / Firebase - Return the Key and the Value from Firebase

output is wrong if i am putting value of principal=100, rate = 4, year=1 then simple interest will be 4

Why does my HashMap.get returns null value even after putting proper key,value?