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 …

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\
rm -Rf ~ / Library / Preferences / AndroidStudio *
rm ~ / Library / Preferences /
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 *

Please let me know if there is a solution. Thank you.

1 Like

Hi, exact same issue for me. After update AS to 4.1, cocos2dx 4.0 project was scanning files to index half of day, truly. Problem noticed only for ndk projekt apparently. Windows 8.1. Thanks.

Android Studio did take longer than usual to index all the source files after updating to Android Studio v4.1 (particularly when indexing the files in the Android NDK). Also, it is highly unlikely that this issue has anything to do with Cocos2d-x.

It doesn’t take a longer time, it doesn’t end no matter how many hours you wait. Eventually I solved the problem by reverting Android Studio to 4.0 Preview.

1 Like

I forgot to mention that I’m using AS 4.1 on Windows 10, so perhaps the issue you’re experiencing is specific to MacOS.

It does take a longer time, but I waited until the end of the scan on my mac. It looks like Android Studio try to index whole ~Library folder, including every subfolder. It took a few hours, but after that, a was managed to compile my project without further problems.