Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MAUI android, how to reference a .JAR library

We are creating application for android device that works as handy terminal (with barcode reader, RFID reader, LED, 10-key keyboard). The device's maker provide a SDK in the JAR format, to be used with Android Studio for example. I have read this link, but this not applies to JAR files. How I can reference an JAR library in MAUI project? Thank for your time, Antonio

like image 647
AntonioHL Avatar asked Oct 19 '25 20:10

AntonioHL


1 Answers

Thank you @Koji, I had already checked some issues (1340,1475,8634).

The correct template is .NET MAUI class library (must be); but the 'Build Action' must be configured inside the project file ".csproj". Although the "Build Action=none" in properties window, inside the project file I added the following lines

<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
    <EmbeddedJar Include="classes.jar" />
</ItemGroup>

After build the project, a sketch class ("PlatformClass1") is created automatically for each platform. After that, it is now possible to create objects with the contents of the 'jar' library. enter image description here

like image 142
AntonioHL Avatar answered Oct 21 '25 10:10

AntonioHL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!