When working with .NET MAUI, you may need to integrate an Android .aar
(Android Archive) library. This guide walks you through the process of using a .aar
file in a .NET MAUI project by creating a Java Library Binding.
Steps to Include an .aar
File in a .NET MAUI Project
1. Create a New Android Java Library Binding Project
In your .NET MAUI solution, create an Android Java Library Binding project. This project will act as a wrapper around the .aar
file, making it accessible to your MAUI app.

2. Add the .aar
File
- Navigate to the
Transforms
folder inside your Android Java Library Binding project. - Copy and paste the
.aar
file into this folder. - Right-click on the
.aar
file and select Properties.

3. Set the Build Action
- In the Properties window, find the Build Action setting.
- Set it to Android Library.
This tells the project to treat the .aar
file as an Android dependency.

4. Reference the Android Library in the MAUI Project
- Open the .csproj file of your MAUI project.
- Add a reference to the Android Library Binding project, ensuring it is only included in Android builds:
xmlCopyEdit<ProjectReference Include="YourAndroidLibraryProject.csproj"
Condition="'$(TargetFramework)' == 'net9.0-android35.0'" />
Replace YourAndroidLibraryProject.csproj
with the actual name of your Android Java Library Binding project.

5. Clean and Build the Project
- Perform a Clean Build to ensure everything compiles correctly.
- Now, you can use the included Java library inside your MAUI project.

Final Thoughts
By following these steps, you can successfully integrate an Android .aar
file into your .NET MAUI project, enabling you to use native Android features while maintaining a cross-platform development workflow.