Android Studio stuck at "Analyzing..." but only when opening Java files

When I've updated Android Studio version to 2020.3.1 on Windows 10, my android studio stopped recognizing code of Java files, it just stucks at analyzing mode and displays plain code and does not show any errors or it takes forever to show it.

I looked at all other problems on Stackoverflow similair to this, but nothing I tried seems to help.

For example here: Android Studio stuck at "Analyzing..." They focus on Kotlin, but not Java and for me Kotlin works well, it just stucks at "Analyzing..." when opening Java files.

I tried opening other projects with my Android Studio and this problem does not disappear. I also tried reinstalling Android Studio, updating all libraries, Invalidate caches / restart - didn't help.

Does anyone know what's wrong could be with Android Studio?


Solution 1:

After spending all day, I finally solved this issue. Here is what I did on Windows 10:

  1. Go to Users/YourName
  2. Type %AppData% in location bar on top
  3. AppData > Roaming location should appear now, open Google folder and delete all Android Studio folders
  4. Then go back to AppData Folder, open Local folder, then Google folder and delete all android Studio folders here too.
  5. Restart Android Studio.

Solution 2:

Try deleting .gradle .android folder from AppData