Application之属性debuggable

来源:互联网 发布:js 获取div自定义属性 编辑:程序博客网 时间:2024/06/02 00:01

会看到有人说只有当你把application中的debuggable设置为true的时候,才可以在机器上进行调试,如果不设置的话,默认为false。

今天楼主尝试了下,这句话是错的。

我新建了个程序,并且没有设置debuggable该属性,即它为false,楼主将他安装在手机上,并设置断点,发现依旧可以调试。

有人说这是因为系统中的一个属性叫ro.debuggable值为1,所以默认所有应用程序都是可以调试的,所以不管应用程序中的debuggable为何值。但是我在命令行中看了下该值,发现该值为0,现在楼主呵呵了。


后来我就去androidManifest中去设debuggable的值,发现报错:


中间黄色框的话是这样子的:

Avoid hardcoding the debug mode, leaving itout allows debug and release builds to automatically assign one.

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

If on the other hand you specify a specificvalue in the manifest file, then the tools will always use it. This can lead toaccidentally publishing your app with debug information.

现在大家应该懂了吧,这段英文我就不翻译了,我的语文比较差快哭了快哭了快哭了快哭了

所以呢在Android中如果不设置debuggable,他默认是可调试的,即为true。但是如果你发布的是一个Release版本,那么它又会默认为false。


0 0
原创粉丝点击