References to other resources are not supported by build-time PNG generation

前端 未结 8 2002
陌清茗
陌清茗 2020-12-12 11:25

AndroidStudio 3.0 / Android Gradle plugin 3.0


  

8条回答
  •  时光取名叫无心
    2020-12-12 12:11

    Little bit more context for this error:

    • Android 5.0 (API level 21) was the first version to officially support vector drawables.
    • If you use minSdkVersion lower than 20, there are two solutions for vector drawable
      • Android Studio's Vector Asset Studio generate PNG. Please take a look Android Studio document. But, references to other resources are not supported by build-time PNG generation.
      • Use support library
    • Or, use 21 or above for minSdkVersion

    For support library, add a statement to your build.gradle file:

    android {
      defaultConfig {
        vectorDrawables.useSupportLibrary = true
      }
    }
    
    dependencies {
      compile 'com.android.support:appcompat-v7:23.2.0'
    }
    

提交回复
热议问题