Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
When this option is selected, the IDE does not offer a way to individually assign unique versionCode values to the various output APK manifests. It seems to randomly generate them instead.
Setting versionCode ("Version number") in the Android Application options page to "29"
Enabling "Generate one package (.apk) per selected ABI" in the Android Build options page
Selecting "armeabi-v7a", "x86", and "arm64-v8a" ABIs to support
In this example, I ended up with three APK files (as expected) with versionCodes of "262173", "196637", "131101" (not expected). The IDE and build process did not prompt for this information at any time.
And of course, if you make the mistake of uploading these to Google Play (even to Alpha or Beta) then this has the potential to completely break any formal version numbering system you might have been using since Google does not allow packages to be deleted (only unpublished). I learned this the hard way :(
I had the same problem. Opted in for the one apk for each abi method, resulting in random version numbers to be thrown in into the single apks.
As I distributed the archive via Visual Studio, the damage was already done there.
Now I have to manually built the apk for the abis with correct versioning (following this scheme https://developer.xamarin.com/guides/android/advanced_topics/build-abi-specific-apks/#Creating_the_Version_Code_for_the_APK), which means editing the Manifest and the project file manually every time again. Loosing up to an hour because Release builds are taking some time.
Created attachment 23095 [details]
Sample project to demonstrate bug.
Seeing the same issue.
Steps to duplicate:
1. Open the attached sample. Notice that the versionCode is set to 29, and that "ABI per APK" is selected.
2. In Visual Studio for Mac, select Build > ARchive for Publishing to create the APKS.
3. Examine the versionCode of each APK (I used aapt dump badging NAME_OF_APK.apk).
4 If you examine the output of aapt dump badging, you will see that the versionCode for each APK is different, and not version 29.
The APK would be build with versionCode 29 assigned to it.
At the moment this is by design if you select the "per Abi apk" option. You can see the code that is executed in 
So a version code if 29 will result in
29 | 5 << 16 = 327709
This is because each apk (per abi) cannot have the same version code. This is a google play restriction.
That said looking at the docs 65535 is no longer the max value for the version code.
It is 2100000000 so our code needs to be updated to allow this.
If this is by design, then the behavior should be documented clearly and called out as a warning in the project options page. There are very real ramifications to this for app developers (see the final paragraph of the initial report).
*** This bug has been marked as a duplicate of bug 51620 ***