Android studio 1.5.1: Could not find property 'vectorDrawables'

后端 未结 4 427
悲&欢浪女
悲&欢浪女 2021-01-12 09:43

I\'m using Android Studio 1.5.1, Gradle 2.8 and my project min sdk vserion:14, target sdk version: 23.

So, When I add vectorDrawables to configuration by documentat

4条回答
  •  长情又很酷
    2021-01-12 09:57

    If you’re using v2.0 or above of the Gradle plugin you have to use:

    android {
      defaultConfig {
        vectorDrawables.useSupportLibrary = true
      }
    }
    

    If you hare using v1.5.0 or below of the Gradle plugin you need to add the following to your app’s build.gradle:

    android {
      defaultConfig {
        // Stops the Gradle plugin’s automatic rasterization of vectors
        generatedDensities = []
      }
      // Flag to tell aapt to keep the attribute ids around
      aaptOptions {
        additionalParameters "--no-version-vectors"
      }
    }
    

    Don't confuse gradle with the gradle plugin. Check the build.gradle in the root folder (or inside the module) to get the version used by the gradle plugin (check the line classpath 'com.android.tools.build:gradle:1.5.0')

提交回复
热议问题