8

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
    }
}
onusopus
  • 1,234
  • 11
  • 16
  • I guess this is because you can't make the release build debuggable. – Shadab Ansari Jun 03 '16 at 19:16
  • Im sorry. I thought i had taken this Q down. It was my mistake. I was doing something if the app was not debuggable. I was hitting a db and hence the issue. Since i was doing it only for ! debuggable version, thats why release with debuggable = true was working fine. – onusopus Oct 12 '16 at 14:59

2 Answers2

1

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

Lino
  • 5,084
  • 3
  • 21
  • 39
0

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.

Ramvignesh
  • 210
  • 6
  • 16