Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
173 views
in Technique[技术] by (71.8m points)

Android 'debuggable' default value

I am trying to get application's debuggable attribute value from code:

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

And I have noticed that when debuggable attribute is not specified in manifest this code defines it as true. And documentation says that it is false by default.

What's wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From SDK Tools : ( SDK Tools, Revision 8 (December 2010) )

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...