I\'m trying to figure out why the heck my Android studio isn\'t recognizing the AppCompat v7 library correctly. The import statement below shows up as gray and says there\'s
1.Delete the .idea folder
2.Close and reopen the project
3.File - > Sync Project With Gradle Files
This worked for me
The issue could be import reference,
try changing it.
From:
import android.support.v7.app.AppCompatActivity;
To:
import androidx.appcompat.app.AppCompatActivity;
I just commented it and used androidx and now it's working all good!
import androidx.appcompat.app.AppCompatActivity;
// import android.support.v7.app.AppCompatActivity;
Okay, I fixed it by rebuilding it for doing a ./gradlew clean assemble for the fourth time... Android Studio is a weird thing
If the given solutions does not work, create a new project with 'KOTLIN' as the language even if your work is on java. Then replace the 'main' folder of the new project with the 'main' folder of the old.
If you have already tried
Still facing issue then please read below
I tried everything mentioned in all the answers and failed.
Go to gradle.properties make these flags false
android.useAndroidX=false
//Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false
The above flags were
"true ,for me and hence gradle won't download v7 components"