James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Live, Love, Bike, and Code



Using Java SDK 11 on Xamarin Android Builds on Azure DevOps & GitHub Actions

Everything is building great in your CI/CD pipeline and then BOOM your build fails for no reason. You didn't change anything in your code!?!?! That was me this morning as I was updating my InAppBilling Plugin for .NET. I got hit with this beauty:

error XA0031: Java SDK 11.0 or above is required when using $(TargetFrameworkVersion) v13.0

What is going on?!?!? Starting with Visual Studio 2022 17.8, which was just released, the Xamarin.Andriod tooling requires Java SDK 11.... but the default images on Azure DevOps still have the default set to an earlier version. No worries! as you can manually set this with the Java tool installer task as the first step in the process.

Here is the YAML:

- task: JavaToolInstaller@0
  displayName: 'Use Java 11'
    versionSpec: 11
    jdkArchitectureOption: x64
    jdkSourceOption: PreInstalled

If you are using GitHub Actions, you can use the actions/setup-java action first: https://github.com/actions/setup-java

After that you are good to go!

Copyright © James Montemagno 2023 All rights reserved. Privacy Policy

View Comments