Android – Upload failed You need to use a different version code for your APK because you already have one with version code 2

androidapk

According to this answer How to solve "Your APK's version code needs to be higher than 2." in Google Play's Developer Console? I have just changed the version code from 2 to 3 and it failed to upload the build.

This is my old manifest before I uploaded the apk

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="mypackage name"
    android:installLocation="auto"
    android:versionCode="28"
    android:versionName="1.0028" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />
        .....

here is the new version code which I have to upload on android developer console. See my menifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="mypackage name"
    android:installLocation="auto"
    android:versionCode="2"
    android:versionName="2.0001" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />
        ......

I dont know whats the issue. Any help?
enter image description here

Best Answer

For people who use Android Studio the problem may be solved by editing versionCode and versionName in build.gradle instead of AndroidManifest.xml.

e.g.

defaultConfig {
    applicationId "com.my.packageId"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 2      <-- change this
    versionName "2.0"  <-- change this
}