Search code examples
androidandroid-studiogradle

After updating to gradle wrapper 8.7 Android Studio search everywhere window includes files from gradle cache folder


I have updated my project from Gradle 8.6 to 8.7 and something broke in Android Studio, every time I do a search using Search Everywhere dialog, it searches in my .gradle folder in addition to the files of my project. I want Android Studio to search only in my project files, and not in the .gradle folder. I'm using the latest version of Android Studio (Koala Feature Drop 2024.1.2).

I checked the .gradle folder in the Project View, and it's marked orange, so it should be excluded from search.


Solution

  • I have found a solution! The problem is that there are 2 .gradle folders: one in your project, and one in your home directory (so ~/.gradle). The ~/.gradle one was not marked as orange by Android Studio for some reason after gradle update. So all I needed to do is mark it as excluded from my project source. Here is a step by step guide:

    1. Do a search in Android Studio using Ctrl+Shift+F
    2. A lot of weird gradle files will appear cluttering your search
    3. Select a random file from the gradle folder and open it in Android Studio
    4. Open the Project Tool Window and switch from Android to Project Files.
    5. Click the "Select Opened File in Project Tool Window" button
    6. It will show the ~/.gradle folder for you (note: this is different from the .gradle folder in your project)
    7. Right click this folder in Android Studio and choose Mark Directory As -> Excluded

    That's it! You won't have files from the ~/.gradle folder appearing in your search results anymore.