title: BuildConfig.VersionCode is not reflecting the actual versionCode after updating to AGP 3.2.0
body: <p>After updating to AGP(Android Gradle Plugin) 3.2.0 we can't set <code>versionCode</code> directly on a <code>mergedFlavor</code>. If we do so we get this useful warning:</p>
  
  <pre><code>versionCode cannot be set on a mergedFlavor directly.
  versionCodeOverride can instead be set for variant outputs using the following syntax:
  android {
      applicationVariants.all { variant -&gt;
          variant.outputs.each { output -&gt;
              output.versionCodeOverride = 40805
          }
      }
  }
  </code></pre>
  
  <p>After this change everything works fine besides one little thing. The auto-generated <code>BuildConfig.VERSION_CODE</code> doesn't reflect the version code from <code>output.versionCodeOverride = 40805</code>.</p>
  
  <p>Before AGP 3.2.0 we could set the versionCode dynamically through:</p>
  
  <pre><code>applicationVariants.all { v -&gt;
          v.mergedFlavor.versionCode = 40805 // 40805 is hardcoded as an example but it is archived dynamically.
      }
  </code></pre>
  
  <p>And the version code reflected in <code>BuildConfig.VERSION_CODE</code> (this is very handy) and I would like to archive the same with AGP 3.2.0.</p>
  
  <p>I know I could workaround this by creating a custom build config field for this like <code>variant.buildConfigField('int', 'OVERRIDDEN_VERSION_CODE', "${versionCodeOverride}")</code> and this will generate the <code>BuildConfig.OVERRIDDEN_VERSION_CODE</code> with the versionCode I override. Archiving the same as I was when using the AGP version bellow 3.2.0 by setting the <code>versionCode</code> through <code>mergedFlavor.versionCode = 40805</code> but I don't like this kind of workarounds.</p>
  
  <p>Is there any way to have the <code>output.versionCodeOverride = 40805</code> being reflecting in the auto-generated <code>BuildConfig.VERSION_CODE</code>?</p>
  
  <p>PS: If we set the <code>versionCode</code> directly in the specific flavor it will work as expected but that's not what I want to know :)</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Found a similar question(with a well described use case) and considering the discussions we had I could give a better answer <a href="https://stackoverflow.com/questions/48111353/does-buildconfig-version-code-not-get-changed-if-we-are-using-multiple-apks/52508053#52508053">here</a>.</p>