今天在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包下测试。规范存在也有道理,遵守这个原则总不会大错。