无法在 AndroidManifest.xml 中设置可调试标志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23986724/
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 07:41:34  来源:igfitidea点击:

Can not set debuggable flag in AndroidManifest.xml

androidandroid-ndkandroid-manifest

提问by Narek

I try to accomplish this tutorialto learn debugging NDK apps, but when I set android:debuggable="true"in AndroidManifest.xml file the following error occurs:

我尝试完成本教程以学习调试 NDK 应用程序,但是当我android:debuggable="true"在 AndroidManifest.xml 文件中设置时出现以下错误:

Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one

避免硬编码调试模式;省略它允许调试和发布版本自动分配一个

How to solve it to be able to debug Teapot app?

如何解决它才能调试茶壶应用程序?

回答by Igor Tyulkanov

See official doc for SDK Tools, Revision 8 (December 2010)

请参阅SDK 工具的官方文档,修订版 8(2010 年 12 月)

Support for a true debug build. Developers no longer need to add the android:debuggableattribute to the <application>tag in the manifest — the build tools add the attribute automatically. In Eclipse/ADT, all incremental builds are assumed to be debug builds, so the tools insert android:debuggable="true". When exporting a signed release build, the tools do not add the attribute. In Ant, a ant debug command automatically inserts the android:debuggable="true"attribute, while ant release does not. If android:debuggable="true"is manually set, then ant release will actually do a debug build, rather than a release build.

支持真正的调试版本。开发人员不再需要将android:debuggable属性添加 到<application>清单中的标签——构建工具会自动添加属性。在Eclipse/ADT 中,所有增量构建都假定为调试构建,因此工具会插入 android:debuggable="true". 导出已签名的发布版本时,工具不会添加该属性。在 Ant 中,ant debug 命令会自动插入android:debuggable="true"属性,而 ant release 则不会。如果android:debuggable="true"是手动设置,那么 ant release 实际上会进行调试构建,而不是发布构建。

Update

更新

If you really want to disable checking for debuggable flag in Eclipse you should do next:

如果您真的想在 Eclipse 中禁用检查可调试标志,您应该执行以下操作:

  1. Go to the Project Preferences:
  2. Select Android Lint Preferences
  3. Find HardcodedDebugModeId in Securitysection and select it
  4. Change the value of Severityto Warningfor example.
  5. Applyand Ok.
  1. 转到项目首选项
  2. 选择Android Lint 首选项
  3. Security部分找到HardcodedDebugModeId并选择它
  4. 例如,将严重性的值更改为警告
  5. 申请确定

Screen for details:enter image description here

屏幕详情:在此处输入图片说明