Skip to content Skip to sidebar Skip to footer

Android Permission Error Even With Declaration In Manifest.xml

I am trying to open an intent to choose a photo from the android gallery and then set an image view in the parent activity with the chosen image. I am able to open gallery and choo

Solution 1:

The question is not clear, but I suspect you are compiling with android-23 API (Marshmallow) and It has introduced the new way of asking the user for permission on the spot of using it, so have two choices

  1. (Recommended) Ask the user for that permission before using it. More info here.
  2. (NOT recommended) Change you target API to a pre-Marshmallow version and that reverts to the old way of asking about all the permissions on application installation.

Solution 2:

    permissions = newString[2];
    permissions[0] = Manifest.permission.WRITE_EXTERNAL_STORAGE;
    permissions[1] = Manifest.permission.READ_EXTERNAL_STORAGE;
    ActivityCompat.requestPermissions(
            this,
            permissions,
            5
    );

I just needed to explicitly ask for permission to read/write external storage in my activity because of android marshmallow.

Post a Comment for "Android Permission Error Even With Declaration In Manifest.xml"