Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java source directories for Android Studio project flavors not rendered in blue

Tags:

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?

like image 381
Gorets Avatar asked Feb 11 '14 09:02

Gorets


1 Answers

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:

prodmark

uat is active here:

uatmark

like image 86
Piyush Agarwal Avatar answered Oct 02 '22 00:10

Piyush Agarwal