Getting "debuggable" value of androidManifest from code?

Solution 1:

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));

Solution 2:

You can now use the static boolean field BuildConfig.DEBUG to achieve the same thing. This class is generated during compilation and can be seen in your gen folder.