2015/05/16

Solution to problem uploading APK to Google Play Store

Solution to problem uploading APK to Google Play Store

Problem:

Upload failed
You need to use a different version code for your APK because you already have one with version code 1.


Solution:

In addition to updating the “android:versionCode” and ”android:versionName” in AndroidManifest.xml, the “versionCode” and “versionName” in build.gradle also need to be updated.



AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.whhuang.simplest_price_compare"

    android:versionCode="3"
    android:versionName="1.3">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.whhuang.simplest_price_compare"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 3
        versionName "1.3"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
}

After the APK is successfully uploaded, a summary sheet similar to the one below will appear.



Reference: http://stackoverflow.com/questions/24772407/upload-failed-you-need-to-use-a-different-version-code-for-your-apk-because-you

No comments:

Post a Comment