Hello,
You need to follow the steps below to add the Jar package to the Maui project.
Step 1. Right-click your solution
in Visual Studio and select Add
-> New Project
from the menu.
Step 2. In the pop-up window, select the new .NET MAUI Class Library
project to add to the solution. Note that the .NET version used by the Class Library needs to be the same as the MAUI project.
Step 3. Right-click the Class Library project created in the solution and select Add
-> Existing Item
to add the jar package.
Step 4. Double-click the Class Library project and add the following code in the project file to use the Jar package.
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
<EmbeddedJar Include="AclasOS2Sdk.jar" />
</ItemGroup>
Step 5. Right-click the Dependencies
property of the MAUI project, select Add Project Reference
, check the created Class Library project in the pop-up window, and select OK
.
After completing the above steps, you can use the classes in this Jar package in the MAUI project.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.