Cannot resolve symbol AppCompatActivity - Support v7 libraries aren't recognized?

后端 未结 25 1489
情深已故
情深已故 2020-12-07 18:39

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

相关标签:
25条回答
  • 2020-12-07 19:02

    I had the same problem in my newly started project with minimum api 23, and finally i have added these lines of codes in my gradle dependency file and it solved the error:)

     implementation 'com.android.support:appcompat-v7:28.0.0'
     implementation 'com.android.support:customtabs:28.0.0'
     implementation 'com.android.support:support-vector-drawable:28.0.0'
     implementation 'com.android.support:support-media-compat:28.0.0'
    
    0 讨论(0)
  • 2020-12-07 19:02

    Delete .idea folder in your project which is hidden folder. Goto your project in the system and Click ctrl+H it will be visible then delete it. Now restart your android studio.I will resolve. Its working for me.

    0 讨论(0)
  • 2020-12-07 19:02

    Include import androidx.appcompat.app.AppCompatActivity; in your MainActivity.java with other import statements. This would look like:

    this resolved my issue

    0 讨论(0)
  • 2020-12-07 19:07

    I got the same exact error with In case it helps others .. documenting what worked for me useful for very latest (Jan 14, 2017) latest everything. Tried all the Invalidate, build clean, even deleting .gradle/, tweaking the support libs etc.. on multiple stack overflow answers.

    I found that upgrading the settings.gradle gradle version fixed it (it was 2.1.3) something in gradle toolchain seems to classpath 'com.android.tools.build:gradle:2.2.3'

    0 讨论(0)
  • 2020-12-07 19:08

    I changed from "... extends ActionBarActivity" to "... extends AppCompatActivity" and tried cleaning, restarting, Invalidate Caches / Restart and wasn't getting anywhere. All my versions were up to the latest.

    What finally solved it was making sure my import was correct:

    import android.support.v7.app.AppCompatActivity;
    

    For some reason it didn't get set up automatically like I was used to and I had to add it manually.

    Hope that helps someone!

    0 讨论(0)
  • 2020-12-07 19:09

    We don´t need to delete files, just invalidate caches to restart configuration:

    0 讨论(0)
提交回复
热议问题