Reputation: 1244
All, we are facing a weird issue where our app is working fine in a debug build variant. But it is failing to execute properly on a release build variant. The even weird thing is that if we set debuggable to true for the release build variant, it works fine. Proguard is disabled in both variants.
Im trying to understand what is the difference between the release and debug build variants in android. could you point me to any resources which helps me to understand the differences ?
Thank you
The following works. But if i remove the debuggable, it fails to work properly. Debug build always works.
buildTypes {
release {
debuggable true
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}
Upvotes: 8
Views: 4451
Reputation: 212
Check if you have used anything like BuildConfig.DEBUG in your java files. That must be causing an issue.
I was once facing the same problem. I found that I was using a code like if(BuildConfig.DEBUG) { Toast(...); }
. That was the problem for me. I changed it to if(!BuildConfig.DEBUG) { Toast(...); }
which made my application to work in the release version of the application.
Upvotes: 0
Reputation: 6160
Maybe the problem is related to the signing of the apk. If you use debuggable true
then your app is signed with a generic debug keystore and everything works correctly.
Conversely, if you remove it you have to provide
storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"
More info here:
https://developer.android.com/studio/build/build-variants.html#build-types
Upvotes: 1