Have you or someone you know been physically harmed or emotionally scarred by the stress of setting up Continuous Integration on VSTS for your Xamarin.Android project? If your answer is yes, you are entitled to no compensation, but this blog post might help.
Easily one of the most frustrating experiences I’ve had with CI so far. It seemed that after I worked through one issue breaking the build, another two popped up. It’s like fighting the Hydra of builds.
Of course everything built fine on my local machine as well as on my other developers’ machines! So WTF VSTS???
Let’s look at some common errors you might have run into. If none of these cover your problems, leave a comment and we can try to sort it out after.
“Major version 51 is newer than 50, the highest major version supported by this compiler.”
Maybe you’ve run into this problem during your actual builds in the past. Basically the issue is that the latest Android Support Libraries build with a newer version of the compiler. The fix is simple – in VSTS, set your JDK version explicitly to 8.
- In your build definition, go to your Build Xamarin.Android project step
- Scroll down the the JDK options section
- Select JDK Version
- Select JDK 8 from the JDK Version dropdown
“java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize)”
The error is at least pretty explanatory. You ran out of memory in your Java Heap.
The solution is to increase your Java Heap explicitly:
- In your IDE (VS or XS), go to your Android project
- Open the properties for your project
- Set your configuration to Release (or whatever configuration your VSTS build runs as)
- Go to the Android Options Tab
- Go to the Advanced tab
- Go down to the Advanced Android Build Settings
- Set the Java Max Heap Size to something larger such as “1G”
These errors can be common and are only applicable to basic Android builds. This does not cover Continuous Deployment to services such as HockeyApp or Visual Studio Mobile Center.
Don’t forget to leave a comment if you’ve run into any different issues!