How to debug the Android App in release mode using Android studio
In your gradle file, you must add debuggable ability in your release flavor.
buildTypes { release { debuggable true minifyEnabled false signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } debug { debuggable true minifyEnabled false applicationIdSuffix '.debug' } }
signingConfig
is release configuration it must be added in gradle file in android{} block, something like this:
signingConfigs { release { keyAlias 'YourAppKey' keyPassword 'somePassword' storeFile file('appkeyfile.jks') storePassword 'somePassword' }}
In my case, I have created the debug configuration same as previous release build and started debugging. It means you have to give sign build in debug version also in build gradle.
signingConfigs { config { keyAlias 'abc' keyPassword 'xyz' storeFile file('<<KEYSTORE-PATH>>.keystore') storePassword 'password' }}buildTypes { debug { debuggable true signingConfig signingConfigs.config proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' }}
So It will have the same sign as release build and you can debug when it runs.
buildTypes { release { debuggable true minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'}}
happy coding.Mark this answer up..if it helps.. :)