title: Gradle build error after updating android studio: NumberFormatException for versionCode
body: <p>I got an error I had not before:</p>
  <pre><code>Execution failed for task ':app:generateDebugBuildConfig'.
  &gt; Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'buildConfigPackageName'.
     &gt; Failed to query the value of property 'packageName'.
        &gt; java.lang.NumberFormatException: For input string: &quot;${versionCode}&quot;
  </code></pre>
  <p>The android studio version is:</p>
  <pre><code>Android Studio 4.1.1
  Build #AI-201.8743.12.41.6953283, built on November 5, 2020
  Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64
  VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  </code></pre>
  <p>The build.gradle(:app) file contains the following:</p>
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-android-extensions'
  
  apply plugin: 'kotlin-kapt' //&lt; for image visualization with glide
  
  //Serialization
  apply plugin: 'kotlinx-serialization'
  
  
  android {
      signingConfigs {
          release {
              storeFile file('xxxx.jks')
              storePassword 'xxxxxxx'
              keyPassword 'xxxxxxxx'
              keyAlias 'my-app'
          }
      }
      compileSdkVersion propCompileSdkVersion
      buildToolsVersion propBuildToolsVersion
  
      defaultConfig {
          applicationId &quot;com.user.myapp&quot;
          minSdkVersion propMinSdkVersion
          targetSdkVersion propTargetSdkVersion
          versionCode 3
          versionName &quot;2.0-beta.26&quot;
          manifestPlaceholders = [versionCode:&quot;3&quot;, versionName:&quot;2.0-beta.26&quot;]
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
  
      buildTypes {
          debug {
              applicationIdSuffix &quot;.debug&quot;
              debuggable true
              resValue &quot;string&quot;, &quot;app_name&quot;, &quot;myapp-dev&quot;
          }
  
          optimizedDebug {
              initWith debug
              minifyEnabled false
              applicationIdSuffix &quot;.optimizedDebug&quot;
              debuggable false
              resValue &quot;string&quot;, &quot;app_name&quot;, &quot;myapp-optimized-dev&quot;
          }
  
          debugProd {
              initWith debug
              minifyEnabled false
              applicationIdSuffix &quot;.debugProd&quot;
              debuggable true
              resValue &quot;string&quot;, &quot;app_name&quot;, &quot;myapp-logs-in-prod&quot;
          }
  
          release {
              minifyEnabled false
              resValue &quot;string&quot;, &quot;app_name&quot;, &quot;myapp&quot;
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              signingConfig signingConfigs.release
          }
      }
  
      applicationVariants.all { variant -&gt;
          variant.resValue &quot;string&quot;, 'images_file_path', &quot;Android/data/\&quot;${applicationId}\&quot;/files/Pictures&quot;
      }
  
      /* Necessary to have Parcelable / @Parcelize functionalities */
      androidExtensions {
          experimental = true
      }
  
  
      lintOptions {
          checkReleaseBuilds false
          abortOnError true
      }
  }
  
  dependencies {
      ...
  }
  
  repositories {
      mavenCentral()
  }
  </code></pre>
  <p>I have invalidated the caches and restarted several times, nothing changes.
  I would like to pinpoint exactly what happens, to at least be able to understand what causes gradle to be confused.
  Can anyone point me to a step by step run of gradle to find what is the problem ?</p>