google play application upload failed

2019-01-26 07:28发布

问题:

apk upload failed to the google play market.

I am trying to upload the upgraded version of my app to the google play but I am keep getting the message -

Upload failed

You need to use a different version code for your APK because you already have one with version code 1.
Your APK needs to have the package name com.corntail.project.

There is still something that is looking for com.corntail.project and it is not being found.

UPDATE:

In my AndroidManifest.xml, the relevant code is -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.corntail.main"
    android:versionCode="1"
    android:versionName="1.0" >

回答1:

If you're using Android Studio or building with gradle, edit your gradle script (build.gradle) to change your package name and version. These values overwrite your AndroidManifest.xml file.

For example:

 defaultConfig {
        applicationId "com.xyz.abc"
        minSdkVersion 16
        targetSdkVersion 19
        versionCode 2
        versionName "1.1"
    }


回答2:

You need to change your android:versionCode="1" to 2 on the AndroidManifest...



回答3:

Things you have to keep in mind when updating your application on Google Play :

  1. Change Version code +1 depending on the old value - if it's 1 , you have to change it to a bigger number.

  2. Change your App Version Name to something bigger / different if it's string - if your old version is 1.0 - it should be 1.1 / 1.0.1 or whatever you like (it's always a better option t have some version name strategy, if it will contains the date update addded or the revision it depends on you).

And if you want to be able to update your app, don't change project package name! That's how android system knows that this application is different than that one. If you change your package name, it's now acting like a new app and you won't be able to update it from Google Play Store! To change your package name to com.corntail.project first you need to change it in manifest and after that in your project's main package and you need to keep track of your activities, if you declared them with package name too. For example :

if your MainActiivty was declared in manifest like :

com.corntail.main.MainActivity 

you need to change it now to be like :

com.corntail.project.MainActivity.


回答4:

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

You must change your version code in your androidmanifest.xml



回答5:

Every time you update your app change this variable in you XML file:

android:versionCode="1"


回答6:

You are getting 2 errors.

  • The Version Code: you always need to set a higher number in the versionCode and always use an integer number. (don't use 1.1)

    android:versionCode="1"

  • The package name: it has to match the same string that you used in the latest version that you upload. So instead of package="com.corntail.main" you should use:

    package="com.corntail.project"

After modify the AndroidManifest.xml save it and then search in the folder src the package called "com.corntail.main", right click, Refactor > Rename, and the new name should match what you put in package (in this example you should call it: 'com.corntail.project') and you are done!

Good luck!



回答7:

You have change version code in increasing order i.e. 1,2,3...so on as every time you uploaded. In every upload version code should have greater number than previous upload version code. You can change version code in APP Module Build.gradle file.

Image

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId "com.xyz"
        minSdkVersion 14
        targetSdkVersion 24
        versionCode 5
        versionName "1.1.4"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


回答8:

If you build with gradlew, you should check the build.gradle file, the applicationId will overwrite the package value in the AndroidManifest.xml

android {
    defaultConfig {
        applicationId "xxx.xxx.xxx"
    }
}