Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scanning files to index never ends in Android Studio 4.1

I'm using cocos2d-x v4, macOS Catalina 10.15.6, Android Studio 4.1.

I made a project with cocos2d-x v4.

I'm using Android Studio to build an android app.

Until a few days ago it worked. But after updating Android Studio to 4.1, everything went wrong. When I open the project, it says Scanning files to index .. at the bottom of Android Studio and it never ends.

The Android tab on the left always says loading ..

enter image description here enter image description here

I tried the following, but none of them solved the problem.

  • Invalidate Caches / Restart
  • Uninstall and reinstall Android Studio
  • Reinstall an older version of Android Studio

When I uninstalled Android Studio, I ran the following command to remove all the old files.

rm -Rf /Applications/Android\Studio.app
rm -Rf ~ / Library / Preferences / AndroidStudio *
rm ~ / Library / Preferences / com.google.android.studio.plist
rm -Rf ~ / Library / Application \ Support / AndroidStudio *
rm -Rf ~ / Library / Logs / AndroidStudio *
rm -Rf ~ / Library / Caches / AndroidStudio *
rm -Rf ~ / .gradle
rm -Rf ~ / .android
rm -Rf ~ / Library / Android *

I spent a lot of time reinstalling Android Studio. I want to resolve this issue as soon as possible. Please let me know if there is a solution. Thank you.

enter image description here enter image description here enter image description here

like image 738
noprops Avatar asked Oct 17 '20 10:10

noprops


3 Answers

I have the same but I solved by removing .idea directory at root directory of the Android project.

like image 89
kumamotone Avatar answered Oct 17 '22 00:10

kumamotone


A very simple solution is delete all caches:

1 close Android Studio

2 go to:

C:\Users\ME\AppData\Local\Google\AndroidStudio2020.3 // or your current version

3 then click in "caches" directory

4 then delete all the cache files (There are two folders called project_resources and resources well DO NOT DELETE THESE FOLDERS)

5 Restart Android Studio

like image 26
MarkT Avatar answered Oct 17 '22 00:10

MarkT


I have the same issue with a Cocos2d-X 3.17 project. Worked perfectly in 3.5 but with 4.1 it keeps on indexing. Force stopping and reopening leads to an eternal beachball.

By removing all .iml files and the .idea folders in the project and by invalidating all caches in Studio I got the project to load. Then I let it index all night (in Activity Monitor I could see that it was reading a lot of data... far more than the 15GB the project size is) without touching anything.

In the morning it actually was done indexing. However; Studio wanted to update some components and after that the index hell started again (using an imac pro with MacOS 10.15.7).

Update: Android Studio 4.1 seems to be indexing everything on the computer. It's now working on ~/Library/Containers/com.apple.iWork.keynote. Problem is that in there, there is a symbolic link to the drive which then results in recurring scanning and rescanning of folders. This also explains why the app wanted access to contacts, calendar and reminders....

Update 2: I have seemed to have solved it for now by excluding the application project folder from the index (right click on folder, select "mark directory as" and select excluded). For the folders to show you might have to delete the .idea and .gradle folders in the project before starting Studio).

like image 3
Sjaak Avatar answered Oct 16 '22 23:10

Sjaak