IdkHowToCodeAtAll
IdkHowToCodeAtAll

Reputation: 241

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

Upvotes: 8

Views: 10008

Answers (2)

OneCricketeer
OneCricketeer

Reputation: 191701

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

Upvotes: 29

Boukharist
Boukharist

Reputation: 1229

You should import

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

Upvotes: 4

Related Questions