Learn why your Xamarin Android build fails with "Error executing task Aapt: VersionCode is outside 0, 65535 interval" and how to workaround that issue.
As we first heard about that issue we wondered how this could happen. We took a look at the build process and couldn't find anything that is obvious. It is counting up the build number and set that as the version code.
Yet, there are cases that can lead you into this trouble. One to mention is the case if you are using the entire build date as your version code. We have seen some configurations going that way. That is not a problem in general as the max value of an integer is big enough. Google Play accepts version codes up to 2.100.000.000 according to the documentation.
Searching for a solution I came to this question at the Xamarin forums and bug ticket 51620 - which is not accessesible anymore due to the move from bugzilla to github. Both suggest to disable the "Generate one package (.apk) per selected ABI" option under the Android Build settings.
This suggested solution works. But it can lead in a bloated apk file depending on the selected ABIs configured under the "Advanced"-tab. If you distribute separate ABI-packages to Google Play, you need another way to go.
If you do not want to end like this guy on stackoverflow, follow these steps to update your version code after Xamarin.Android builds your apk.
apktool d $APK_PATH -o $OUTPUT_FOLDER
apktool build $OUTPUT_FOLDER
jarsigner -verbose -keystore $KEYSTORE_PATH -storepass $KEYSTORE_PASSWORD -keypass $KEYSTORE_KEY_PASSWORD $APK_PATH $KEYSTORE_KEY_NAME ~/android-sdk/build-tools/25.0.2/zipalign -v 4 $APK_PATH $APK_OUT_PATH
A quick reminder to take a look at Xamarins documentation on how you should create version codes for abi specific apks, if you go that route.
Als Mobile-Enthusiast und Geschäftsführer der Cayas Software GmbH ist es mir ein großes Anliegen, mein Team und unsere Kunden zu unterstützen, neue potenziale zu entdecken und gemeinsam zu wachsen. Hier schreibe ich vor allem zur Entwicklung von Android und iOS-Apps mit Xamarin und .NET MAUI.
Like what you read? Come work with us.
During a current project we needed to evaluate possibilities to easily set up a Continuous Integration and Deployment system. For several reasons we normally would suggest an In-House solution with TeamCity, but the customer preferred a cloud solution to shorten the procurement and installation process. In this post I explain why and how we set up Bitrise.
As a developer we all know about that rumor of writing any kind of test is a costly task. In this post I would like to show you a better way for writing UI tests that even makes it fun when it comes to a very large mobile app.
Beim BeeWi Car handelt es sich um ein ferngesteuertes Auto der Firma BeeWi. Während meines Besuchs des gestrigen Workshops auf dem Developer Open Space in Leipzig zum Thema "Internet of Things", hatte ich den ersten Kontakt mit diesem kleinen Spielzeugauto.