Embedding .NET in Java
How to use a Xamarin .NET library in a Java-based Native Android Project
- PDF for offline use
Let us know how you feel about this
last updated: 2018-02
In some cases, you may want to add a Xamarin .NET library to an existing native Android project. To do this, you can use the Embeddinator-4000 tool to turn your .NET library into a native library that can be incorporated into a native Java-based Android app.
To use the Embeddinator-4000 with Java on Android, you will need the following:
Android Studio – Android Studio 3.x or later must be installed.
Xamarin.Android – Xamarin.Android 7.4.99 or later must be installed.
Java Developer Kit – Java 1.8 or later must be installed.
Mono – Mono 5.0 or later must be installed.
You can use Visual Studio to edit and compile your C# code.
You can use Visual Studio for Mac to edit and compile your C# code.
Using the Embeddinator-4000
To consume a .NET library in a native Android project, you use the following steps:
Create a C# Android Library project.
Install Embeddinator-4000 via NuGet.
Run Embeddinator on the Android library assembly.
Use the generated AAR file in a Java project in Android Studio.
These steps are described in detail in the Embeddinator-4000 documentation.