Can not find Symbol Manifest.permission.WRITE_EXTERNAL_STORAGE on v23
Asked Answered
R

8

29

I am compile code with following build.gradle file

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {

        applicationId "com.example"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

For accessing saving photo into SDCARD i have opened permission Dialog box for V23

like below screenshot

enter image description here

But I am getting following error that

Can not find Symbol Manifest.permission.WRITE_EXTERNAL_STORAGE

I have put sdkVersion to 23 but why i am still getting this error

Rew answered 2/11, 2015 at 7:35 Comment(1)
As of Android 23 EVERY thing has changed!!!Liquidate
R
64

Finally I found that Menifest file is autogenerated by Android Studio

In AndroideMenifest i have written following code for ParsePushNotification

 <!--
      IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
      to match your app's package name + ".permission.C2D_MESSAGE".
    -->
    <permission android:protectionLevel="signature"
        android:name="com.example.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.example.permission.C2D_MESSAGE" />

and below menifest file is generated

enter image description here

So when i have written code below it's works

android.Manifest.permission.WRITE_EXTERNAL_STORAGE

instead of

Manifest.permission.WRITE_EXTERNAL_STORAGE

Rew answered 2/11, 2015 at 9:57 Comment(3)
Or you can just import android.Manifest.Interlaken
Why is WRITE_EXTERNAL_STORAGE bothered by C2D_MESSAGE permission? I have same issue. In my case I need to use C2D_MESSAGE from Manifest, rather than android.Manifest...Tristichous
Manifest.permission.WRITE_EXTERNAL_STORAGE : not working means you are importing wrong one. I have imported java.util.jar, and getting this errorDosimeter
M
45

Only write Android before manifest class. Change:

Manifest.permission.WRITE_CALENDAR

to:

android.Manifest.permission.WRITE_CALENDAR

Monogamous answered 25/8, 2016 at 5:53 Comment(0)
D
10

I think you can use Manifest class from android in android.Manifest.permission or android.Manifest.permission_group. For detail permission types you can read from this Manifest.permission, see this

int permissionCheck = ContextCompat.checkSelfPermission(thisActivity,
    android.Manifest.permission.WRITE_CALENDAR);
Dorcus answered 24/3, 2016 at 3:50 Comment(1)
Do, import android.Manifest . It will solve the issue. _ThanksAcuna
H
4

the solution to this problem is simple..just add the word "android" before the word "manifest".

android.Manifest.permission.WRITE_CALENDAR

Hegelianism answered 4/5, 2017 at 20:40 Comment(0)
G
3

Read this article please.

Since the permission system is redesigned there are some permissions that need access to be revoked and some others that do not. The specific permission that you request is in a group that is called android.permission-group.STORAGE. Check this out.

Try this out:

private static final int REQUEST_EXTERNAL_STORAGE = 1;
    private static String[] PERMISSIONS_STORAGE = {Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.WRITE_EXTERNAL_STORAGE};

            ActivityCompat.requestPermissions(mActivity, PERMISSIONS_STORAGE,
                     REQUEST_EXTERNAL_STORAGE);
Gantz answered 2/11, 2015 at 7:54 Comment(0)
J
1

Just Write android before Manifest.permission.WRITE Example : android.Manifest.permission.WRITE_EXTERNAL_STORAGE;_EXTERNAL_STORAGE.

Jude answered 14/3 at 7:59 Comment(1)
Thank you for your interest in contributing to the Stack Overflow community. This question already has quite a few answers—including one that has been extensively validated by the community. Are you certain your approach hasn’t been given previously? If so, it would be useful to explain how your approach is different, under what circumstances your approach might be preferred, and/or why you think the previous answers aren’t sufficient. Can you kindly edit your answer to offer an explanation?Eight
S
0

Two solutions are here :

1. Add import android.Manifest to the imports section.
2. Add the android keyword before the permission name (e.g. android.Manifest.permission.CAMERA)

Shoshone answered 27/2 at 17:47 Comment(0)
M
0

import android.Manifest is the solution if IDE is not recognizing Manifest.permission.WRITE_EXTERNAL_STORAGE

Mechanics answered 16/4 at 10:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.