我最近安装了最新的Canary版Android Studio,目前正在使用Android Gradle插件3.0.0-alpha4
(之前为2.3.3
)。
我现在收到所有buildConfigFields的警告:
buildTypes {
def BOOLEAN = "boolean"
def STRING = "String"
def INT = "int"
def TRUE = "true"
def FALSE = "false"
def SOME_PER_BUILD_TYPE_FIELD = "SOME_PER_BUILD_TYPE_FIELD"
debug {
buildConfigField BOOLEAN, SOME_PER_BUILD_TYPE_FIELD, FALSE
}
release {
buildConfigField BOOLEAN, SOME_PER_BUILD_TYPE_FIELD, TRUE
}
警告内容如下:
Warning:BuildType(debug): buildConfigField 'SOME_PER_BUILD_TYPE_FIELD' value is being replaced: false -> false
Warning:BuildType(debug): buildConfigField 'SOME_STRING_FIELD' value is being replaced: "999" -> "999"
对于我的各种领域和构建类型,其中有100个。我如何解决它们以及实际告诉我的警告是什么?
答案 0 :(得分:5)
Build system warns you that some buildConfigField
is being re-assigned.
The two shown fields are being re-assigned to the same value, which hints that one of the following scenarios might be happening:
答案 1 :(得分:0)
最幼稚的解决方案是将buildConfigField
部分中的所有debug
移到defaultConfig
部分。