Saad Farooq Saad Farooq - 1 year ago 31
Android Question

Android 23 Not Generating Manifest file for uses-permission elements

I have project with several interdependent modules which we just upgraded to target android-23.

The issue is, the app doesn't seem to generate

etc. properties when I use
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
in AndroidManifest.

However, it does generate the properties when I do
<permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
but this just seems different to any and all examples I've seen.

For reference, our versions are:

minSdkVersion = 18
compileSdkVersion = 23
targetSdkVersion = 23
buildToolsVersion = "23.0.2"

and support libraries are

Anyone run into this or have any ideas what's going on?

Adding the generated file contents I see in

public final class Manifest {
public static final class permission {
public static final String C2D_MESSAGE="com.example.permission.C2D_MESSAGE";
public static final String RECEIVE_ADM_MESSAGE="com.example.permission.RECEIVE_ADM_MESSAGE";
public static final String UA_DATA="com.example.permission.UA_DATA";

Answer Source

That is as intended.

When you add <permission> in your manifest, you are defining your own permission. So, this is added to the class <your_package_name>.Manifest.

However, when you add <uses-permission> in your manifest, you are NOT defining a new permission, but specifies that you are requesting a permission which is already defined by elsewhere (mostly not in your application). So, in this case, the permission is not added to the class <your_package_name>.Manifest. Instead, it can be found at <package_defining_the_permission>.Manifest class. For the ACCESS_FINE_LOCATION permission, it is defined in the package named android: