目录

Android could not get unknown property for applicationVariants

text

could not get unknown property for 'applicationVariants' for BuildType xxxx

text

buildTypes {
    release {
        applicationVariants.all { variant ->
            appendVersionName(variant, defaultConfig)
        }
    }
}

applicationVariants 只包含在 apply plugin: 'com.android.application' 插件中

如果使用 apply plugin: 'com.android.library'

gradle

buildTypes {
    release {
       libraryVariants.all { variant ->
            appendVersionName(variant, defaultConfig)
        }
    }
}
  • applicationVariants 只在 com.android.application
  • libraryVariants 只在 com.android.library
  • testVariants 都含有,但一般只有默认的 debug