Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol 'permission' Android Studio

This is the line of code I'm having issues with

    int permissionCheck = ContextCompat.checkSelfPermission(MainActivity.this,
            Manifest.permission.WRITE_EXTERNAL_STORAGE);

It's inside my public class MainActivity extends AppCompatActivity {

There is no option to import anything

img

Here is a list of my imports

img2

like image 907
IdkHowToCodeAtAll Avatar asked Feb 17 '16 23:02

IdkHowToCodeAtAll


People also ask

What is Cannot resolve symbol in Android Studio?

Most often “R cannot be resolved” error appears if there is an issue with some of your resource files. Due to this error, you are unable to build your application. That's why we need to solve this error as it not getting away by just doing a simple restart or hitting Alt+Enter.

What does Cannot resolve symbol mean in Java?

The cannot find symbol error, also found under the names of symbol not found and cannot resolve symbol , is a Java compile-time error which emerges whenever there is an identifier in the source code which the compiler is unable to work out what it refers to.


2 Answers

You are importing the wrong Manifest class...

// import java.util.jar.Manifest; // wrong

import android.Manifest; // correct

or use android.Manifest.permission.WRITE_EXTERNAL_STORAGE

like image 107
OneCricketeer Avatar answered Sep 24 '22 03:09

OneCricketeer


You should import

android.Manifest and not java.util.jar.Manifest

like image 30
Boukharist Avatar answered Sep 21 '22 03:09

Boukharist