How to workaround Xamarin Androids VersionCode limitation
Learn why your Xamarin Android build fails with "Error executing task Aapt: VersionCode is outside 0, 65535 interval" and how to workaround that issue.
How can this happen
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.
How to fix that - Option 1
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.
How to fix that - Option 2
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.
Build your Xamarin Android project with any version code between 0 and 65000
Open a command line and call apktool d $APK_PATH -o $OUTPUT_FOLDER
Open the apktool.yml text file and alter the versionCode entries
Rebuild with apktool build $OUTPUT_FOLDER
The new apk needs to be re-signed with the original keystore file
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.
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.