Android:如何将我的应用程序标记为可调试?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2952140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:01:58  来源:igfitidea点击:

Android: how to mark my app as debuggable?

androiddebuggingandroid-manifest

提问by mtmurdock

I want to debug my app from my phone. How do I sign my app so I can do this? I don't know much about the manifest.

我想从我的手机调试我的应用程序。我如何签署我的应用程序以便我可以这样做?我对清单了解不多。

回答by drawnonward

By putting android:debuggable="true"in your manifest file, application will go in debug mode, that's mean android will manage all logs file regarding your application. But make sure put it again false(or remove this tag) if application will going to live or for release mode.

通过放入android:debuggable="true"您的清单文件,应用程序将进入调试模式,这意味着 android 将管理有关您的应用程序的所有日志文件。但是false如果应用程序将要上线或发布模式,请确保再次放置(或删除此标签)。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    <application android:icon="@drawable/icon"
        android:debuggable="true"

回答by Christian García

With the new Gradle build system, the recommended way is to assign this in the build types.

使用新的 Gradle 构建系统,推荐的方法是在构建类型中分配它。

In your app module's build.gradle:

在您的应用程序模块中build.gradle

android {

    //...

    buildTypes {
        debug {
            debuggable true
        }
        customDebuggableBuildType {
            debuggable true
        }
        release {
            debuggable false
        }
    }

   //...

}