gpt4 book ai didi

Android 'debuggable' 默认值

转载 作者:IT老高 更新时间:2023-10-28 22:19:22 29 4
gpt4 key购买 nike

我正在尝试从代码中获取应用程序的可调试属性值:

packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);           
int flags = packageInfo.applicationInfo.flags;
isDebugMode = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;

而且我注意到,当 list 中未指定可调试属性时,此代码将其定义为 true。并且文档说默认情况下它是错误的。

怎么了?

最佳答案

来自 SDK Tools :(SDK 工具,第 8 版(2010 年 12 月))

Support for a true debug build. Developers no longer need to add the android:debuggable attribute 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' 默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5701343/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com