如何使用Android Studio在发布模式下调试Android App

问题描述:

由于某种原因,我必须在发布模式下运行我的Android应用程序.运行该应用程序时,必须像在调试模式下使用代码一样运行代码.在发布模式下运行时,断点没有达到,我在清单中添加了android:debuggable="true".断点仍然没有达到.任何帮助.

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.

预先感谢

就我而言,我已经创建了与先前发行版相同的调试配置并开始调试.这意味着您必须在构建gradle中也要在调试版本中提供sign build.

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.