Vector Drawable 不会被 Build Variant Flavor Dimension 覆盖

cre*_*n90 5 android android-gradle-plugin android-vectordrawable build-variant

我有一个带有基本品牌和多个白标品牌以及多个服务器目标的应用程序。在我的应用程序的 build.gradle 中,口味定义为: flavorDimensions("server", "whitelabel")

在我src/main/res/drawable的基础品牌中,我有一个 logo.xml VectorDrawable,它在src/whitelabel1/res/drawable.

当我的应用程序的 build.config 包含vectorDrawables.useSupportLibrary = true正确的 logo.xml 时,将在我的 ImageView 中使用。如果我useSupportLibrary从 Whitelabel1main的 apk 中删除ImageView 渲染logo.xml

<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" />
Run Code Online (Sandbox Code Playgroud)

Irf*_*Ali 2

这也发生在我身上。仅在 defaultconfig 中写入此 vectorDrawables.useSupportLibrary = true 后。矢量资源是从风味源集文件夹中选取的。