can't resolve AppCompatActivity

后端 未结 30 1702
星月不相逢
星月不相逢 2020-12-04 17:43

After renaming application package name, Android Studio displayed this error can\'t resolve symbol AppCompatActivity

Things I tried: <

相关标签:
30条回答
  • 2020-12-04 18:19

    This is what worked for me, strangely enough:

    1. Change implementation 'com.android.support:appcompat-v7:26+' to implementation 'com.android.support:appcompat-v7:26.0.1'
    2. Go to File → Invalidate Caches/Restart
    3. Wait for the Gradle sync to finish on restarting. Once it does you will be prompted to add the Google maven support repository. Click on the corresponding link, and let Gradle resolve the dependencies.
    4. The errors should be gone now

    FWIW, in my case the issue occured after moving my Android Studio installation to a new machine and upgrading to AS 3.1.

    0 讨论(0)
  • 2020-12-04 18:19

    Guys I know this is gonna sound stupid but I only switched my project like I had 2 projects in my system so I opened the other project when it was completely ready I clicked on open to open my actual project and it worked so just try to switch projects and re open it, this should sort out your issue.

    0 讨论(0)
  • 2020-12-04 18:19

    Close your project using FILE -> CLOSE PROJECT and then Open, worked for me fixed all the issues.

    0 讨论(0)
  • 2020-12-04 18:21

    If methods like

    Clean project

    Clean Android Studio cache

    Clean Gradle cache

    Re-installed IDE

    File-> Invalidate cache/restart

    do not work. use this method to resolve your issue.

    Exit Android Studio

    Navigate in your project to the .idea folder

    Remove .idea folder

    Restart Android Studio.

    Thats it.

    0 讨论(0)
  • 2020-12-04 18:22

    Only removing whole .gradle folder helped me.

    0 讨论(0)
  • 2020-12-04 18:24

    I was having the same issue, but when I did Invalidate cache/restart option it worked fine for me.

    First try to clear all your build files

    Build->Clean

    if it doesn't work try this option

    File -> Invalidate cache/Restart

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