How to solve “Your APK's version code needs to be higher than 2.” in Google Play's Developer Console?

后端 未结 16 632
半阙折子戏
半阙折子戏 2020-12-08 09:28

I\'m getting this error when uploading my Phonegap app to the Google Play Developer Console:

Your APK\'s version code needs to be higher than 2.

<
相关标签:
16条回答
  • 2020-12-08 09:55

    I found that if you are using Android Studio, you need to update the version code in the build.gradle file. For example:

    defaultConfig {
        applicationId "app.myapp"
        minSdkVersion 14
        targetSdkVersion 20
        versionCode 2
        versionName "1.0.0"
    }
    

    ...

    0 讨论(0)
  • 2020-12-08 09:56

    For my Cordova built app, the Gradle file didnt have the static code. It was picked using Android Manifest like this -

    defaultConfig {
    versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode") + "0")
    applicationId privateHelpers.extractStringFromManifest("package")
    
    if (cdvMinSdkVersion != null) {
        minSdkVersion cdvMinSdkVersion
    }
    

    }

    I tried changing the version code in the manifest file, but no luck.

    Not a good thing to do, but out of hurry I did this -

    defaultConfig {
    versionCode cdvVersionCode ?: (Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode") + "0") + 2)
    applicationId privateHelpers.extractStringFromManifest("package")
    
    if (cdvMinSdkVersion != null) {
        minSdkVersion cdvMinSdkVersion
    }
    

    }

    Note: For Cordova built apps, you need to make changes in the Gradle Scripts > File which says - "build.gradle (Module:android)"

    0 讨论(0)
  • 2020-12-08 09:57

    enter image description here

    Please see attached snap of Android Studio which should help.

    0 讨论(0)
  • 2020-12-08 09:59

    I suppose that you already have a version 2 uploaded to your dev console. Simply increase the version code (note: NOT version name!) to 3, rebuild your APK and you are fine.

    0 讨论(0)
  • 2020-12-08 10:00

    If you're directly using Gradle, or indirectly through Android Studio:

    I fixed it by editing the version number inside of the build.gradle file! There is a small banner at the bottom of the android.manifest file that says "these changes are being overwritten by the build.gradle file."

    0 讨论(0)
  • 2020-12-08 10:01

    Had the same problem. Changing the version wasn't helpful. For Android builds you can add versionCode to your config.xml and state the version.

        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "xxx.xxxxxx"
        versionCode = "415" 
        version   = "1.0.11">
    

    Check http://docs.build.phonegap.com/en_US/3.1.0/configuring_basics.md.html#The%20Basics

    0 讨论(0)
提交回复
热议问题