AndroidManifest中debuggable

今天在AndroidManifest的配置中看到ide在这个配置项上做了红色提醒。于是看了一下官方对这个配置的说明:

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

It's best to leave out the android:debuggable attribute from the manifest. If you do, then the tools will automatically insert android:debuggable=true when building an APK to debug on an emulator or device. And when you perform a release build, such as Exporting APK, it will automatically set it to false.

If on the other and you specify a specific value in the manifest file, the the tools will always use it. This can lead to accidentally publishing your app with debug information.

做过自动化测试的同学们都知道在做测试的时候这个开关是必须打开的。按照上面所说,我们并不需要手动的配置,发布debug包的时候编译工具会自动添加该属性为true。发布release包的时候该属性也会自动设为fale。一切都帮我们做好了。

回到最初看到这个提示,这个标签是应该去掉的。如果需要测试,也应该在debug包下测试。规范存在也有道理,遵守这个原则总不会大错。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值