3

In my application, I have 2 flavors, and I want to change the application's color (res/color) for each of this flavors!

Please see my code below at build.gradle file :

flavorDimensions "default"
productFlavors {
    app1 {
        applicationId "com.app.myApp1"
        resValue "string", "app_name", "App 1"
        manifestPlaceholders = [
                appIcon: "@drawable/logo_app1"
        ]
    }
    app2 {
        applicationId "com.app.myApp2"
        resValue "string", "app_name", "App 2"
        manifestPlaceholders = [
                appIcon: "@drawable/logo_app2"
        ]
    }
}

I don't know on setting the color.xml for each of this flavors!

How can this be possible?

Biscuit
  • 3,364
  • 3
  • 15
  • 33
Dr Circle
  • 41
  • 5

1 Answers1

4

Did you create a separate as below:

[Project Root]
  -[Module]
    -src
      -main
      -app1
        -res
          -drawable-*
            -logo_app.png
      -app2
        -res
          -drawable-*
            -logo_app.png

If you do it shold work on its own without needing to specify anything in the gradle file.

Article with no gradle file configuration: https://medium.com/@orafaaraujo/flavors-e01015eff979

Article with gradle file configuration: https://medium.com/@sgkantamani/android-product-flavors-eb526e35f9f1

Biscuit
  • 3,364
  • 3
  • 15
  • 33