Reputation: 12169
I have a large project folder that contains many sub projects. Only 4 are part of the Android project, the rest are C code.
However, it appears that Android Studio is indexing ALL of it, which takes a long time.
How do I exclude these other directories from indexing?
There no way to explicitly do it, and the Module Settings only lists the Android projects so I cannot remove the other folders from there.
Upvotes: 32
Views: 11458
Reputation: 856
Just add the following at project's build.gradle file.
tasks.processResources {
exclude("**/*")
}
Upvotes: 0
Reputation: 108
As there is no "Mark directory as" menu in Android Studio, I found out that such settings like including and excluding directories are stored in a ".iml" file. Named like "project-name.iml".
A line like bellow is used to exclude a dir:
<excludeFolder url="file://$MODULE_DIR$/src/main/x/" />
So, Re-including is done as easily as removing the line.
Upvotes: 0
Reputation: 3299
In the left side project panel, right click the file you want to exclude from indexing, and then select Mark as Plain Text
.
Upvotes: 0
Reputation: 201
Upvotes: 20
Reputation: 1610
Use the 'idea'
plugin to exclude directories. For some reason, it seems the idea
configuration is ignored if a subproject is configuring it (and will always exclude the project.buildDir
and .gradle
folders), but it works if you tell the root project which directories to exclude:
In your root project build.gradle
file, do
apply plugin: 'idea'
idea {
module {
excludeDirs.add(file('path/to/subproject'))
excludeDirs.add(file('path/to/othersubproject'))
}
}
After syncing, you'll notice that the root projects .iml
file contains corresponding <excludeFolder>
tags, and that Android Studio no longer indexes the directories.
Upvotes: 10
Reputation: 4026
Excluded
and hit enter.Careful, I haven't been able to find a way to 're-include' folders back yet.
Upvotes: 26