'Retrofit null response after publishing app

When I install the app from android studio. The app works fine. But after publishing the app it's not working fine.

Here what I m doing is:- on android studio install, I hit a login API and in the response server sends a token for user login.And i getting this token successfully. But when I publish the app on google play store and the user tries to login I m getting token 'null' in the response of server. And the response code is 200 ok.

And on postman everything working fine and also on the Apple app.

this is my first project. Please help me I tired now from this. Can you guys tell me why it's happening.?

Here is a response screenshot of user login on the published app

Here is my Model Class And Key or Variable Name is 100% okay.

    public class LoginRegistrationModel {

    @SerializedName("success")
    @Expose
    private String success;

    @SerializedName("firstname")
    @Expose
    private String firstname;

    @SerializedName("lastname")
    @Expose
    private String lastname;

    @SerializedName("profile_image")
    @Expose
    private String profile_image;

    @SerializedName("id")
    @Expose
    private int id;

    public void setSuccess(String success) {
        this.success = success;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public void setProfile_image(String profile_image) {
        this.profile_image = profile_image;
    }

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

    public int getId() {
        return id;
    }

    public String getSuccess() {
        return success;
    }

    public String getProfile_image() {
        return profile_image;
    }

    public String getFirstname() {
        return firstname;
    }

    public String getLastname() {
        return lastname;
    }

}


Solution 1:[1]

I tried below code and it works just set minifyEnabled false

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.debug
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hassan Kalhoro