Android could not get unknown property for applicationVariants
目录
错误表现
could not get unknown property for 'applicationVariants' for BuildType xxxx原因
buildTypes {
release {
applicationVariants.all { variant ->
appendVersionName(variant, defaultConfig)
}
}
}applicationVariants 只包含在 apply plugin: 'com.android.application' 插件中
修复方法
如果使用 apply plugin: 'com.android.library'
buildTypes {
release {
libraryVariants.all { variant ->
appendVersionName(variant, defaultConfig)
}
}
}说明
applicationVariants只在com.android.applicationlibraryVariants只在com.android.librarytestVariants都含有,但一般只有默认的 debug