.NET Embedding on Android
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.
For Xamarin.Android to work with .NET Embedding, you need the following:
Xamarin.Android – Xamarin.Android 7.5 or later must be installed.
Android Studio – Android Studio 3.x or later must be installed.
Java Developer Kit – Java 1.8 or later must be installed.
To consume a .NET library in a native Android project, use the following steps:
Create a C# Android Library project.
Locate Embeddinator-4000.exe and add it to your PATH. For example:
Run Embeddinator-4000 on the library assembly. For example:
Embeddinator-4000.exe -gen=Java -out=foo Xamarin.Foo.dll
Use the generated AAR file in a Java project in Android Studio.
Usage and command line options are described in the Embeddinator-4000 documentation.
Learn about making calls between C# and Java.