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:
steps:
- task: JavaToolInstaller@0
displayName: 'Use Java 11'
inputs:
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!