I've installed .NET 6 (version 6.0.100-rc.1.21458.32) and Visual Studio 2020 Preview (although it might be not a prerequisite).
I am trying to debug a hello-world application but I am getting a build error regarding Java.
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.100-rc.1.12\targets\Microsoft.Android.Sdk.Tooling.targets(20,5): error XA0031:
Java SDK 11.0 or above is required when using .NET 6 or higher.
I've installed Java 17 setting Path
as well as pointing to the Java Development Kit Location in Visual Studio settings (tools->options->Xamarin->Android Settings). Because that didn't work I've set the JDK location to Microsoft's openjdk, but it still doesn't work.
What's wrong here?
CodePudding user response:
When I installed VS2022 preview 4, my configuration became C:\Program Files\Microsoft\jdk-11.0.10.9-hotspot
This can be fixed for you if you run the maui-check
command (if you installed that component during visual studio installation).
If you don't have the maui-check
tool, you can get it by running the dotnet tool install -g Redth.Net.Maui.Check
command
Maybe you skipped a step during installation and that's why you get the error.
CodePudding user response:
Installing Microsoft's OpenJDK 11 did the job for me.
You may notice that Visual Studio installs a version of Microsoft OpenJDK, however, you need to install the Microsoft OpenJDK 11