Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore app works in debug but signed apk gives error

I have created complete app with firestore everythings works fine in debug apk but when i create signed apk for publishing it gives me strange error.

While login with signed apk it gives blue lines of

 W/Firestore: (0.6.6-dev) [aei]: No setter/field for updated_at found on class com.binrafiq.reborn.mvp.data.db.model.j
 W/Firestore: (0.6.6-dev) [aei]: No setter/field for token found on class com.binrafiq.reborn.mvp.data.db.model.j
 W/Firestore: (0.6.6-dev) [aei]: No setter/field for image found on class com.binrafiq.reborn.mvp.data.db.model.j
 W/Firestore: (0.6.6-dev) [aei]: No setter/field for phone found on class com.binrafiq.reborn.mvp.data.db.model.j

and red lines with this error.

E/UncaughtException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
                                                          at com.binrafiq.reborn.mvp.ui.login.d$3.a(Unknown Source)
                                                          at com.google.android.gms.tasks.l.run(Unknown Source)
                                                          at android.os.Handler.handleCallback(Handler.java:739)
                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                          at android.os.Looper.loop(Looper.java:148)
                                                          at android.app.ActivityThread.main(ActivityThread.java:5461)
                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

my user model is

public class User {

     public Long id;

     public String user_id;

     public String account_type;

     public String image;

     public String password;

     public String gender;

     public String device_id;


     public String name;

     public String address;

     public String type;

     public String country;

     public String age;


    public String occupation;


    public String hobbies;


    public String dreams;


    public String mobile;


    public String email;


    @ServerTimestamp
    public Date  created_at;

    @ServerTimestamp
    public Date  updated_at;





    public long profile_views;


    public double total_followers,total_following,total_images,total_videos,total_stories;


public User(Long id, String user_id, String account_type, String image, String password, String gender, String device_id, String name, String address, String type, String country, String age, String occupation, String hobbies, String dreams, String mobile,
        String email, Date created_at, Date updated_at, long profile_views, double total_followers, double total_following, double total_images, double total_videos, double total_stories) {
    this.id = id;
    this.user_id = user_id;
    this.account_type = account_type;
    this.image = image;
    this.password = password;
    this.gender = gender;
    this.device_id = device_id;
    this.name = name;
    this.address = address;
    this.type = type;
    this.country = country;
    this.age = age;
    this.occupation = occupation;
    this.hobbies = hobbies;
    this.dreams = dreams;
    this.mobile = mobile;
    this.email = email;
    this.created_at = created_at;
    this.updated_at = updated_at;
    this.profile_views = profile_views;
    this.total_followers = total_followers;
    this.total_following = total_following;
    this.total_images = total_images;
    this.total_videos = total_videos;
    this.total_stories = total_stories;
}



    public User() {
    }


    public User(long l, String currentUserId, String accountType, String currentUserEmail, String currentUserProfilePicUrl,  String currentUserGender, String currentUserDeviceToken, String currentUserName, String currentUserType, long currentUserProfileViews) {
        this.user_id = currentUserId;
        this.account_type = accountType;
        this.image = currentUserProfilePicUrl;

        this.gender = currentUserGender;
        this.device_id = currentUserDeviceToken;
        this.name = currentUserName;
        this.type = currentUserType;
        this.email = currentUserEmail;
        this.profile_views = currentUserProfileViews;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCountry() {
        return country;
    }


    public void setCountry(String country) {
        this.country = country;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getOccupation() {
        return occupation;
    }

    public void setOccupation(String occupation) {
        this.occupation = occupation;
    }

    public String getHobbies() {
        return hobbies;
    }

    public void setHobbies(String hobbies) {
        this.hobbies = hobbies;
    }

    public String getDreams() {
        return dreams;
    }

    public void setDreams(String dreams) {
        this.dreams = dreams;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

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


    public String getEmail() {
        return email;
    }

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

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Date getCreated_at() {
        return created_at;
    }

    public void setCreated_at(Date created_at) {
        this.created_at = created_at;
    }

    public Date getUpdated_at() {
        return updated_at;
    }

    public void setUpdated_at(Date updated_at) {
        this.updated_at = updated_at;
    }



    public String getUser_id() {
        return this.user_id;
    }



    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }



    public String getAccount_type() {
        return this.account_type;
    }



    public void setAccount_type(String account_type) {
        this.account_type = account_type;
    }



    public String getDevice_id() {
        return this.device_id;
    }



    public void setDevice_id(String device_id) {
        this.device_id = device_id;
    }



    public long getProfile_views() {
        return this.profile_views;
    }



    public void setProfile_views(long profile_views) {
        this.profile_views = profile_views;
    }



    public double getTotal_followers() {
        return this.total_followers;
    }



    public void setTotal_followers(double total_followers) {
        this.total_followers = total_followers;
    }



    public double getTotal_following() {
        return this.total_following;
    }



    public void setTotal_following(double total_following) {
        this.total_following = total_following;
    }



    public double getTotal_images() {
        return this.total_images;
    }



    public void setTotal_images(double total_images) {
        this.total_images = total_images;
    }



    public double getTotal_videos() {
        return this.total_videos;
    }



    public void setTotal_videos(double total_videos) {
        this.total_videos = total_videos;
    }



    public double getTotal_stories() {
        return this.total_stories;
    }



    public void setTotal_stories(double total_stories) {
        this.total_stories = total_stories;
    }
}

I have tried lot of answers on stackoverflow by changing naming convention etc but nothing solved my problem.

like image 512
Nouman Ch Avatar asked Dec 23 '22 07:12

Nouman Ch


2 Answers

It looks like your proguard setup doesn't let your model classes be recognized. I'd keep them out of obfuscation with a rule:

-keep class com.binrafiq.reborn.mvp.data.db.model.** { *; }
like image 176
Levi Moreira Avatar answered Jan 18 '23 05:01

Levi Moreira


In release mode if enabled the field names and their method names obfuscated by Progaurd lib. You can add annotation to your field names so that they can be recognizable even after obfuscation.

You do not need to disable or skip your class from progaurd. This way your code will be protected.

Like below:

@PropertyName("businessId")
private String businessId;
@PropertyName("userId")
private String userId;
like image 43
Deepak Rai Avatar answered Jan 18 '23 04:01

Deepak Rai