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?