简体   繁体   中英

Why is an Android app not debuggable by default?

According to Android Doc , an Android app is not debuggable by default.

android:debuggable

Whether or not the application can be debugged, even when running on a device in user mode — "true" if it can be, and "false" if not. The default value is "false".

Now, provided that I create a simplest app by Android Studio through default steps.

  • The AndroidManifest.xml contains no android:debuggable specifier.

  • The default build.gradle file contains no debuggable specifier under buildTypes .

So, as per the Android Doc, the app should not be debuggable by default.

However, I can always debug a newly created app by Android Studio.

Why?

This following post explains it well do not use debugabble attribute

Here are the important notes from it.

There were a time when the Android developer had to take care of updating the debuggable attribute of his app's manifest file, setting it to "true" for debugging, and for "false" just before releasing a new signed package.

But that time passed by on December, 2010. Although not every developer had noticed it, so many of them continue manually doing the debuggable switching.

http://developer.android.com/tools/sdk/tools-notes.html

From SDK Tools revision 8:

Support for a true debug build. Developers no longer need to add the android:debuggable attribute to the 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. Ifandroid:debuggable="true" is manually set, then ant release will actually do a debug build, rather than a release build. So, the best thing you can do in most of the cases is not to deal with the attribute at all, since that way you will be sure that when you are exporting a signed release it won't include debug data.

The only exception is if you actually need to distribute a signed package with debug information included, not a common case indeed...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM