Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vector Drawable Not Overwritten by Build Variant Flavor Dimension

I have an app with a base brand and multiple whitelabel brands along with multiple server targets. In my app's build.gradle,the flavors are defined as: flavorDimensions("server", "whitelabel")

In my src/main/res/drawable I have a logo.xml VectorDrawable for the base brand and it is overwritten in src/whitelabel1/res/drawable.

When my app's build.config contains vectorDrawables.useSupportLibrary = true the correct logo.xml is used in my ImageView. If I remove useSupportLibrary the ImageView renders logo.xml from main even in the apk for Whitelabel1

<ImageView
    android:id="@+id/imageLogo"
    android:layout_width="@dimen/viewXS"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/marginXS"
    android:adjustViewBounds="true"
    android:padding="@dimen/marginXS"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/ic_logo" />
like image 752
cren90 Avatar asked Nov 16 '22 04:11

cren90


1 Answers

It happened with me as well. only after writing this vectorDrawables.useSupportLibrary = true inside defaultconfig. vector resources was picked from the flavor source set folder.

like image 193
Irfan Ali Avatar answered Dec 21 '22 18:12

Irfan Ali