Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

XA4301: Cannot determine ABI of native library on Visual Studio 2019 only (2017 works fine)

When trying to build my project in visual studio 2019 I'm greeted with a few errors regarding some .so library files I'm using

XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.
XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.
Could not determine ABI of some native libraries. Ignoring those: lib\armeabi\libfmod.so
XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.

The strange thing is that the exact same project works fine in visual studio 2017. But I need to use visual studio 2019 in order to support above android 9.
Any ideas?

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.

    The common causes to the issue are:

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

    To fix the issue, try to empty the bin and obj folder of the project to rebuild the code. Or try the solutions from the tutorial:
    https://docs.microsoft.com/en-us/xamarin/android/errors-and-warnings/xa4301

  • EendhoornEendhoorn Member ✭✭
    edited November 2020

    @Jarvan said:

    XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.

    The common causes to the issue are:

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

    To fix the issue, try to empty the bin and obj folder of the project to rebuild the code. Or try the solutions from the tutorial:
    link

    Yeah I found this page in my endless quest to fix this issue, but these things look find. The fact that it builds in visual studio 2017 affirms that.
    The output log shows the error three times, which is kind of strange though.

    XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.
    XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.
    Could not determine ABI of some native libraries. Ignoring those: lib\armeabi\libfmod.so
    XA4301: Cannot determine ABI of native library lib\armeabi\libfmod.so.

    I've tried to add to the project file;

    <AndroidNativeLibrary Include="lib\arm64-v8a\libfmod.so">
          <Abi>armeabi-v8a</Abi>
        </AndroidNativeLibrary>
        <AndroidNativeLibrary Include="lib\armeabi-v7a\libfmod.so">
          <Abi>armeabi-v7a</Abi>
        </AndroidNativeLibrary>
        <AndroidNativeLibrary Include="lib\armeabi\libfmod.so">
          <Abi>armeabi</Abi>
        </AndroidNativeLibrary>
        <AndroidNativeLibrary Include="lib\x86\libfmod.so">
          <Abi>x86</Abi>
        </AndroidNativeLibrary>
        <AndroidNativeLibrary Include="lib\x86_64\libfmod.so">
          <Abi>x86_64</Abi>
        </AndroidNativeLibrary>
    

    It supresses the error when building, but once the app launches I get an exception, which makes it clear that the still problem still persists;

    Java.Lang.UnsatisfiedLinkError: 'dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/Com.Eendhoorn.PhluteApp-r_vyqMcbmEXXVPneLu3UNQ==/base.apk"],nativeLibraryDirectories=[/data/app/Com.Eendhoorn.PhluteApp-r_vyqMcbmEXXVPneLu3UNQ==/lib/arm64, /data/app/Com.Eendhoorn.PhluteApp-r_vyqMcbmEXXVPneLu3UNQ==/base.apk!/lib/arm64-v8a, /system/lib64]]] couldn't find "libfmod.so"'

    I've also tried to disable shared runtime but it makes no difference.
    Here's my entire project file just for some extra info;
    pastebin.com/W0fwET8b

  • EendhoornEendhoorn Member ✭✭

    I have disabled ""arm64-v8a" under Project Settings > Android Options > Advanced > supported architectures and the app now runs. I'm not sure if this will cause problems later on but at least it works for now..

    Came across the solution here;
    github.com/asimmon/MuPDF-for-Xamarin-Android/issues/5

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    Congrats! Please accept your solution as the answer, it'll help others who face the similar problem.

  • EendhoornEendhoorn Member ✭✭

    @Jarvan said:
    Congrats! Please accept your solution as the answer, it'll help others who face the similar problem.

    I wanted to wait it out to see if any more problems would show up, and unfortunately today is that day. I tried to run the app in the android emulator and I got the dreaded "couldn't find xxx.so" again :(

    Java.Lang.UnsatisfiedLinkError
      Message=dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/Com.Eendhoorn.PhluteApp-wQxtJhrjpFU_49u0HMqwNw==/base.apk"],nativeLibraryDirectories=[/data/app/Com.Eendhoorn.PhluteApp-wQxtJhrjpFU_49u0HMqwNw==/lib/x86, /data/app/Com.Eendhoorn.PhluteApp-wQxtJhrjpFU_49u0HMqwNw==/base.apk!/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libfmod.so"
    

    The libfmod.so for x86 is right there so I'm clueless why this is happening. I tried running a x86_64 too but the problem persists. I remember testing the app with the visual studio 2017 emulator just fine, so I'm thinking it's a visual studio settings thing again.

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    I remember testing the app with the visual studio 2017 emulator just fine

    Try to creating a new project using VS 2019 and copy the code to the new sample for test.

  • IvanRobacioIvanRobacio Member

    @Eendhoorn Could you solve that problem?

Sign In or Register to comment.