如何使用 Android Studio 在发布模式下调试 Android 应用程序 [英] How to debug the Android App in release mode using Android studio

查看:55
本文介绍了如何使用 Android Studio 在发布模式下调试 Android 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,我必须在发布模式下运行我的 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 中提供标志构建.

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.

这篇关于如何使用 Android Studio 在发布模式下调试 Android 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆