Can not find Symbol Manifest.permission.WRITE_EXTERNAL_STORAGE on v23

跟風遠走 提交于 2019-12-03 11:06:58

问题


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

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


回答1:


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

So when i have written code below it's works

android.Manifest.permission.WRITE_EXTERNAL_STORAGE

instead of

Manifest.permission.WRITE_EXTERNAL_STORAGE




回答2:


Only write Android before manifest class. Change:

Manifest.permission.WRITE_CALENDAR

to:

android.Manifest.permission.WRITE_CALENDAR




回答3:


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



回答4:


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

android.Manifest.permission.WRITE_CALENDAR




回答5:


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


来源:https://stackoverflow.com/questions/33472723/can-not-find-symbol-manifest-permission-write-external-storage-on-v23

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!