When I run an Android build on Cloud Build, it ignores “AndroidBundleVersionCode” in project settings, and replaces it automatically with the cloud build number, for example, “18” (but it gets automatically incremented). Then when we upload the APK to the Google Play Store, it causes an automatic rejection with the error message “Upload failed. You need to use a different version code for your APK because you already have one with version code 18.”
DETAILS
Specific example: a recent build was run on cloud build, using “Latest Unity 2017.2” (in this case: Unity 2017.2.1f1 - but it doesn’t matter if I set the unity version to “Latest 2017.2” or some specific, older 2017.2 patch version).
The project specifies the following bundle information in ProjectSettings.asset:
bundleVersion: 0.9.0
buildNumber:
iOS: 1
AndroidBundleVersionCode: 1
EXPECTED BEHAVIOR: the APK should be built with version “0.9.0” and bundle version “1” as specified in project settings.
OBSERVED BEHAVIOR: the APK is built with bundle version “18”, which is the automated build code of that cloud build run. This is incorrect, and causes failures when uploading to the Google Play Store.
This only happens on Android, not on iOS builds. iOS builds respect the “buildNumber/iOS” entry in ProjectSettings.
(Edited to remove irrelevant details.)