我必须在清单中添加什么才能在实际设备上调试 Android 应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2409923/
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
What do I have to add to the manifest to debug an Android application on an actual Device?
提问by Janusz
What kind of permission/Flag do I have to add to the manifest to debug my application on an actual Android device?
我必须向清单添加什么样的权限/标志才能在实际的 Android 设备上调试我的应用程序?
回答by Mark B
回答by Wooff
You shold create a debug specific manifest file (typically in src/debug/AndroidManifest.xml). To avoid error: "Avoid hardcoding the debug mode." If you run/debug application directly throuh IDE, it is automatically build with android:debuggable="true" flag.
您应该创建一个调试特定的清单文件(通常在 src/debug/AndroidManifest.xml 中)。为避免错误:“避免对调试模式进行硬编码。” 如果您直接通过 IDE 运行/调试应用程序,它将使用 android:debuggable="true" 标志自动构建。
回答by Abish R
The issue is might be you have installed the live app which is not debuggable and you are overwriting with debuggable app. So, uninstall the app which is not debuggable and install your app. I will work. I tried this and worked for me.
问题可能是您安装了不可调试的实时应用程序,并且您正在使用可调试的应用程序覆盖。因此,卸载不可调试的应用程序并安装您的应用程序。我会工作。我试过这个并为我工作。
Before trying this, make sure you are not in release build variantand in app->build.gradle debuggable true
在尝试之前,请确保您不在发布构建变体中并且在app->build.gradle debuggable true