Getting "Debuggable" Value of Androidmanifest from Code

Getting debuggable value of androidManifest from code?

Use PackageManager to get an ApplicationInfo object on your application, and check the flags field for FLAG_DEBUGGABLE.

boolean isDebuggable = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));

Android 'debuggable' default value

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.

How to check Android manifest parameters with code

Here is how to check if the debuggable attribute is set in the manifest:

boolean isDebuggable = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));

Shamelessly stolen from here:

https://stackoverflow.com/a/4277868/483708

This application does not have the debuggable attribute enabled in its manifest

Your comment has already hinted the answer to this post but since you have not selected an answer I'll write it down.

Change build variant from release to debug from android studio left corner.

**Build variant** tab's default position in AndroidStudio

My debug AndroidManifest.xml is giving me cannot resolve symbol errors

Go to File > Invalidate Caches / Restart and Invalidate and Restart.

This cleared the errors for me.

Avoid hardcoding the debug mode; Warning in Android Manifest

Yup, just noticed this too. I removed the debuggable attribute from the manifest, and I can now both run the app in debug mode and export it to a market-ready APK file without changing any code.

Slick!

Full explanation here
https://stackoverflow.com/a/4580630/682754



Related Topics



Leave a reply



Submit