Share via


Xamarin.Android error/warning XA4301

Issue

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

Situations include:

  • Xamarin.Android is unable to determine the Android ABI for the library.
    • If coming from an assembly reference, Xamarin.Android will skip this file and emit a warning mentioning the file.
    • If coming from within the Xamarin.Android project, Xamarin.Android will give an error mentioning the file.
  • Duplicate instances of native libraries were found.
    • Xamarin.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 Xamarin.Android project contains either an @(EmbeddedNativeLibrary) or @(AndroidNativeLibrary) build action in a directory that is not named a valid Android ABI.
  • The Xamarin.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 Xamarin.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.