.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.

Xamarin.Android Requirements

For Xamarin.Android to work with .NET Embedding, you need the following:

Using Embeddinator-4000

To consume a .NET library in a native Android project, use the following steps:

  1. Create a C# Android Library project.

  2. Install Embeddinator-4000.

  3. Locate Embeddinator-4000.exe and add it to your PATH. For example:

    set PATH=%PATH%;C:\Users\USERNAME\.nuget\packages\embeddinator-4000\0.4.0\tools
  4. Run Embeddinator-4000 on the library assembly. For example:

    Embeddinator-4000.exe -gen=Java -out=foo Xamarin.Foo.dll
  5. 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.