Can't import android.support.v4.content.ContextCompat

Viewed 4910

Hi What happen in my android studio i need to use ContextCompat for checkSelfPermission so that i need to import android.support.v4.content.ContextCompat but android studio can't find in this Lib

enter image description here

from this picture you can see this Lib only have media and R but not have content so i have already add implementation in app/build.gradle

implementation "com.android.support:support-v4:27.1.1"

so what i missing here?

Thanks

2 Answers

Add google() under repositories of allprojects like this in your project level build.gradle

allprojects {
    repositories {
        google()

        // If you're using a version of Gradle lower than 4.1, you must
        // instead use:
        //
        // maven {
        //     url 'https://maven.google.com'
        // }
    }
}

Hope this helps

Try updating your support library to latest version 28.0.0-alpha1 and Try Build -> clean Project or Invalidate cache and restart as android studio might not be able to clear old cache.

Related