Excluding a single java file from indexing?
Answered
Can I ask here a question about Android Studio?
I think the same problem also occurs in IDEA.
I think the same problem also occurs in IDEA.
I made 'demo', 'full' flavors and three Calculator.java files each for 'main', 'demo' and 'full'.
I want to use
- demo/java/Calculator.java file for demo flavor
- full/java/Calculator.java file for full flavor
while not removing Cacluator.java in main/java directory.
android {
...
flavorDimensions 'mode'
productFlavors {
demo {
dimension 'mode'
}
full {
dimension 'mode'
}
}
sourceSets {
main { java.filter.exclude('Calculator.java') }
demo {}
full {}
}
}
'Duplicated classes found' IDE warning occurs for Calculator.java. But this project is compiled well.
How can I exclude specific files from indexing in Android Studio?
Can I use 'idea' plugin to resolve this problem?


Please sign in to leave a comment.
For Gradle projects IDEA follows build.gradle, so you need to use exclude or excludeDirs. I doubt that it is the best solution for the case above, have you tried moving same name classes to different packages?