.NET for Android error/warning XA4301

Issue

This message indicates a problem adding an Android native library (*.so file) to your .NET for Android project's APK file during the build.

Situations include:

  • .NET for Android is unable to determine the Android ABI for the library.
    • If coming from an assembly reference, .NET for Android will skip this file and emit a warning mentioning the file.
    • If coming from within the .NET for Android project, .NET for Android will give an error mentioning the file.
  • Duplicate instances of native libraries were found.
    • .NET for Android will include the first entry in the APK and emit a warning indicating the duplicate file.

See the Android documentation to learn about Android ABIs.

Common causes:

  • The .NET for Android project contains either an @(EmbeddedNativeLibrary) or @(AndroidNativeLibrary) build action in a directory that is not named a valid Android ABI.
  • The .NET for Android project is referencing two Android library projects that contain the same native library via an @(EmbeddedNativeLibrary) or @(AndroidNativeLibrary) build item.

Solution

  • Place any Android native libraries within a directory in your .NET for Android project named with the appropriate ABI, such as arm64-v8a, armeabi-v7a, x86, or x86_64.
  • Remove any duplicate instances of the native library.