I want to create a .NET MAUI application that references and calls code .JAR Java Library. I’m following Xamarin instructions for Binding a .JAR. This involves creating a Android Java Library Binding project and adding the *.jar files to it. However, I’m not able to complete the instructions on the web page: it tells me to set the Build Action for the .jar file to EmbeddedJar
, but I don’t have this option.
What’s the correct way to set up a Android Java Library Binding project so that it generates C# binding classes from the .jar files as of Visual Studio 2022 (Version 17.7.0 Preview 6.0)?
2
Answers
I don't know why the
EmbeddedJar
build action is missing in the Properties Window (perhaps its because I'm using a preview version of Visual Studio), but manually editing the .csproj file I was able to change the item types toEmbeddedJar
:Incidently, I also needed to manually modify the .csproj file in my MAUI project to add a condition to project reference otherwise I got build errors for non-Android platform code:
Embedded Jar type was removed since .net 6 because is it slow.
There is a documentation here.