I have an Android Gradle project and I want to create two flavor branches. I'm use the default sourceSets with this structure:
src - main - java - package - res - manifest.xml - flavor1 - java - package - flavor2 - java - package
"main/java", "flavor1/java" is rendered/annotated as Java source in the IDE (i.e., "java" is in blue, and the directories are shown as packages), but "flavor2" is not rendered the same way.
I tried to clear the caches and restart Android Studio but this did not help. How can I fix this?
Your main directory (content root) sources will always be blue colored by default, but others depend on the activeness.
The blue color directory shows that the build variant or content root is active and if you will use the Run
button of IDE, it will take these sources to compile and build you app. Only one content root can be active at a time for building the app.
You can change and make any directory/flavor active for your content root to compile and build your app when run option is used. It can be done from Build Variants
tab available in left panel of your Android Studio.
Like shown in picture below :
Production is active here:
uat is active here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With