This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 51620 - Build error when using a versionCode > 65535 with "Generate one package per selected ABI" feature enabled
Summary: Build error when using a versionCode > 65535 with "Generate one package per s...
Status: ASSIGNED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 7.0 (C8)
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 15.4
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-01-18 18:27 UTC by Keith Rome
Modified: 2017-06-26 09:32 UTC (History)
2 users (show)

See Also:
Tags: bb
Is this bug a regression?: ---
Last known good build:


Attachments
Sample Xamarin.Android project with android:versionCode set to 65536. (48.53 KB, application/zip)
2017-06-23 22:06 UTC, Tom Opgenorth
Details

Description Keith Rome 2017-01-18 18:27:47 UTC
When the "Generate one package per selected ABI" feature is enabled, high numerical values for versionCode ("Version number" in the build options page) cause the build process to fail.

The error produced during build is:

> "Error executing task Aapt: VersionCode is outside 0, 65535 interval" in Xamarin.Android.Common.targets

Disabling the APK per ABI feature works around the problem, but obviously you end up with a single bloated APK that way.

NOTE: There is guidance for using scripts to control the multi-APK build process (here: https://developer.xamarin.com/guides/android/advanced_topics/build-abi-specific-apks/#Creating_the_Version_Code_for_the_APK), but the options UI does not hint at this being a requirement or suggested approach, and the article does not provide a full solution - it leaves the actual script writing/debugging up to the reader.
Comment 1 Tom Opgenorth 2017-06-23 22:06:57 UTC
Created attachment 23094 [details]
Sample Xamarin.Android project with android:versionCode set to 65536.
Comment 2 Tom Opgenorth 2017-06-23 22:16:07 UTC
Steps to duplicate:

1. Open the attached solution.
2. Check the Projection options of the Xamarin.Android project - note that the android:versionCode is set to 65536 and that the APK per ABI is checked. Also note that multiple ABIs are selected.
3. Try to build the Application, the build will fail with the specified error.
4. Go back to the Project Options for the Xamarin.Android project, under Build > Android Build > General, unselect the "On ABI per APK". 
5. Try and build the Application, the build will fail with the same error. 


Expected Result:

Multiple APIs would be created with the specified version code.
Comment 3 dean.ellis 2017-06-26 09:32:03 UTC
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. 


[2] https://developer.android.com/studio/publish/versioning.html

Note You need to log in before you can comment on or make changes to this bug.