Android Studio APK not updating buildVersion

Viewed 867

I'm trying to update an Android app and upload it to the play store, but I keep getting an error that it's using an old versionCode.

I've updated the versionCode parameter in my build.gradle file, but when I run build signed Bundle/APK I notice that the data of the APK is never updated.

I'm not overly familiar with Android Studio - primarily coming from an iOS background, but as far as I can tell this should be all that's needed?

There are no build errors or warnings, and I'm using the "locate" prompt from within Android Studio itself to find the build so I'm not sure what's going on.

I'm using Android Studio version 3.2.1 and it's the latest build as confirmed by check for updates.

defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 5
    versionName "1.4"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

I've tried restarting Android Studio and cleaning the build, but neither has worked, I've always hit the 'sync gradle file' as well after making a change

2 Answers
  1. Press Ctrl + Alt + Shift + S in Android Studio.
  2. app -> Flavors -> defaultConfig -> versionCode (Increment the version number).
  3. Click OK to trigger the Gradle build.
  4. Generate the Android App Bundle and check.

Product Structure Window Gradle Build

So as alluded to in the comments, the fix that worked for me was :

I was using the "Android App Bundle" option for generating for the store which doesn't include the checkboxes for V1 & V2, going through the "APK" option from the generate APK menu though appears to have worked. Odd as surely building for the store should be the default. It seemed to update other files, just not the APK itself

Related