Android app doesn't work after published it by generate signed app

孤人 提交于 2019-12-06 14:05:37

问题


I create an app and it work on emulator. It works on debug apk on device, but when I build it with generate signed app it doesn't work? what is wrong and how I can debug it on device on signed sate?


回答1:


In my project doesn't run signed app. I changed minifyEnabled value from true to false then problem is solve . this bad solution. I'm looking for a better way.

build.gradle :

buildTypes {
        release {
            shrinkResources true
            minifyEnabled false //true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }



回答2:


I found the problem and solved it. I must keep models form obfuscating that use retrofit. After use below code my app work properly in minifyEnabled enabled:

-keep com.xxx.xxx.models.** { *; }

retrofit need to know class properties for filling by values.

Thanks every body try to help me.




回答3:


I found progard has problem with retrofit interfce

Sample of interface:

import java.util.List;

import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;


public interface AClient {
    // For register device for specific package
    @GET("/api/initiate/{packageId}")
    Call<InitiateModel> GetInitiateInfo(
            @Path("packageId") int packageId
    );
  }

I add -dontwarn retrofit2.** in progard file. What is wrong?



来源:https://stackoverflow.com/questions/37419854/android-app-doesnt-work-after-published-it-by-generate-signed-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!