How to resolve conflict between version codes of s

2019-08-01 03:20发布

问题:

In the past I used the following configuration in my gradle file for version code generation using apk splitting:

splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
            universalApk true
        }
    }


project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5,
                                'mips64' : 6, 'x86': 8, 'x86_64': 9]

    android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.versionCodeOverride =
                    project.ext.versionCodes.get(output.getFilter(
                            com.android.build.OutputFile.ABI), 0) * 10000000 +
                            android.defaultConfig.versionCode
        }
    }

Using this configuration I get version codes like 80000034, 20000034, 10000034 for x86, armeabi-v7a, armeabi respectively.

Since we can use App Bundles now, I would like to skip this code and use directly the bundles.

But when I try to upload the bundle, I get the error message, which states that the version code of my bundle is lower, compared to my splitted apks. The bundle gets version code 35, which is obviously less than 10000034. This results in the fact, that the users would not receive any updates because of the version conflict.

Can you tell me, how to resolve conflict between version codes of splitted apks and bundles?

回答1:

Use versionCode 90000035, since that's the first number higher than all other versions that your users received before.