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

后端 未结 16 629
半阙折子戏
半阙折子戏 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: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)"

提交回复
热议问题