Android gradle 3.0.0 buildConfigField warning after updating

The reason is correctly mentioned by Vasiliy. Just to add a little to it, one possible reason for it could be when you have a buildType that is initialised with any other buildType. e.g. consider the following build configurations:

debug {
    buildConfigField 'boolean', 'ENABLE_CRASH_REPORTING', 'false'
}
stage {
    initWith(buildTypes.debug)
    buildConfigField 'boolean', 'ENABLE_CRASH_REPORTING', 'true'
}
release {
    buildConfigField 'boolean', 'ENABLE_CRASH_REPORTING', 'true'
}

In this case, you will get warning for buildType stage

Warning:BuildType(stage): buildConfigField 'ENABLE_CRASH_REPORTING' value is being replaced: false -> true

The reason is pretty simple and obvious that stage inherits all fields from debug and then stage replaces it because you might want to assign them different value for stage (like in the case above). A possible workaround could be replacing

initWith(buildTypes.debug)

with

signingConfig signingConfigs.debug

This will eliminate the signing error you normally get when building stage builds. But the main difference here in the configuration now is; stage will not inherit build variables from debug in this case and therefore you will not get any warning for this too. Also you will have to redefine all build variables in stage in this case as (already mentioned) stage is no more inherited from debug


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. your build script is misconfigured and evaluates some expression twice
  2. your build script have duplicate assignments
  3. gradle by itself evaluates the build script twice, and warns you about its own actions