Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug the Android App in release mode using Android studio

For some reason I have to run my Android App in release mode.I have to run through the code when running the app just like we use in debug mode. My break points are not hitting when I run in release mode, I have added android:debuggable="true" in manifest. Still the breakpoint is not hitting. Any help.

Thanks in Advance

like image 448
Bazi Paleri Avatar asked Nov 19 '15 11:11

Bazi Paleri


People also ask

Can I debug in release mode Android Studio?

It means you have to give sign build in debug version also in build gradle. So It will have the same sign as release build and you can debug when it runs.


2 Answers

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'     } }  
like image 179
once2go Avatar answered Sep 22 '22 05:09

once2go


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.

like image 38
Bazi Paleri Avatar answered Sep 21 '22 05:09

Bazi Paleri