简体   繁体   中英

Cannot resolve symbol 'AppCompatActivity' — NO SOLUTION

I am currently developing an android application. Everything has been working fine, up until the point I decided to add my project to firebase. I did the steps Tools > Firebase > Authentication . I created the project and added firebase to my application.

5 seconds later, I get the Cannot resolve symbol 'AppCompatActivity' error .

I know there are lots of other threads on this issue, and I have read them.

However, no solution seems to work for me. I have tried:

>- Syncing project with gradle files.
>- Change the implementation version in app.gradle
>- Invalidate caches and Restart
>- Delete .idea folder in project path
>- Uninstall and then reinstall Android Studio

All of these with no success. Is there anything else I can do about this? Why does this error occur anyway? Did I mess something?

I'm willing to bet you don't have the appcompat depency implemented in your gradle

implementation 'com.android.support:appcompat-v7:28.0.0'

I managed to fix this issue by uninstalling and reinstalling Android Studio (again) but this time to another location than the initial one.

Initially it was installed under D:\someFolder\Android Studio\ Installing it to the default path C:\Program Files\Android Studio\ seemed to be the only solution for me

I had a related issue. cannot resolve AppCompatActivity suddenly happening despite it previously working and everything looking fine: import, gradle dependency etc. Invalidate cache and restart not working.

Fix: Check for a new Android Studio and Gradle update. In this case updating from Android Studio 4.0 to 4.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM