arm64-v8a Native Library Not Found - Nexus 9 Android 7.1.1

pmhart83pmhart83 USMember ✭✭✭

When building for the Nexus 9 running Android 7.1.1 our Forms app will crash after relaunching the app 2 ~ 4 times. The logcat says something about issue loading a Unity dependency. I was able to fix this problem by adding the architecture arm64-v8a and linking assembly sdks.

But now that the app is not crashing on launch after reopening there are new issues. We use a midi library called "sonivox" and I have the .so files from this repo:

https://github.com/billthefarmer/mididriver/tree/master/libs

In the Android project there is a "lib" folder that has several sub-folders which are:

  • libs
    --- armeabi
    --- armeabi-v7a
    ---- x86
    ---- x86_64
    ---- arm64-v8a

Each subfolder contains "libsonivox.so".

Our app works on the Pixel running 7.1.1 build for armeabi-v7a. But since adding arm64-v8a support for the Nexus 9 running Android 7.1.1, audio playback is broken because there is a disconnect between "libsonivox.so" in the "arm64-v8a" folder getting to the right spot where we can use DllImport to call it's functions.

My debug logs say things like:

[Mono] DllImport error loading library '/system/lib/libsonivox.so': 'dlopen failed: library "/data/app/com.app.smv-1/lib/arm64//system/lib/libsonivox.so" not found'.

Why is it searching "arm64" folders and not "arm64-v8a" folders?

It also has said stuff about un-accessable namespaces.

[linker] library "/system/lib/libsonivox.so" ("/system/lib/libsonivox.so") needed or dlopened by "/data/app/Mono.Android.DebugRuntime-1/lib/arm64/libmonosgen-64bit-2.0.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/com.app.smv-1/lib/arm64:/system/fake-libs64:/data/app/com.app.smv-1/base.apk!/lib/arm64-v8a", permitted_paths="/data:/mnt/expand:/data/data/com.app.smv"]

Nothing like this happens in armeabi-v7a.

Either we put out a build that does not support Nexus 9 on 7.1.1 or I need to figure out how to get this stupid native library to work for 64 bit since it does not work the same as the armeabi-v7a version.

Posts

  • pmhart83pmhart83 USMember ✭✭✭

    I just tested the usage of the arm64-v8a native library on the Pixel that is running Android 7.1.1. It also does not find libsonivox.so from the lib/arm64-v8a folder.

    If I uncheck arm64-v8a support it works using the .so in lib/armeabi-v7a

    Is arm64-v8a the wrong folder name?

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    One thing that I find extremely helpful is the Native Libraries Monitor on Google Play:

    https://play.google.com/store/apps/details?id=com.xh.nativelibsmonitor.app

    This tool will help you determine WHAT libraries are getting installed to your device from your .apk.

    You should get a list of supported ABIs by preference for your device by using the Build.SUPPORTED_ABIS. Please note that most devices are compatible with more than one ABI, but it will only prefer certain architectures over others.

    https://developer.android.com/reference/android/os/Build.html#SUPPORTED_ABIS

    Just know that when you provide a full set of libraries for each ABI, your application will only be installing one of the supported architectures.

    A list of ABIs can be found on the following page:

    https://developer.android.com/ndk/guides/abis.html

    So in short:

    1. Check your device architecture
    2. Get a list of supported ABIs to double check what your device "prefers"
    3. Ensure you have all architectures covered with a proper library
    4. Success!
  • pmhart83pmhart83 USMember ✭✭✭

    @JonDouglas said:
    One thing that I find extremely helpful is the Native Libraries Monitor on Google Play:

    https://play.google.com/store/apps/details?id=com.xh.nativelibsmonitor.app

    This tool will help you determine WHAT libraries are getting installed to your device from your .apk.

    ...

    Thanks for the suggestion. I used the app on the Nexus 9 running 7.1.1.

    ALSO NOTE: We are using the pre2 build of Forms because of a background crashing bug it fixes.

    Nexus 9 Native Libraries installed:

    arm64 lib_sqlite3.so
    arm64 libmono-profiler-log.so
    arm64 libmonodroid.so
    arm64 libmonosgen-2.0.so
    arm64 libsonivox.so //THE ONE I AM LOOKING FOR AND WONT LOAD!

    Nexus 9 Native Libraries Inside APK:

    arm64 lib/arm64-v8a/lib_sqlite3.so
    arm64 lib/arm64-v8a/libmono-profiler-log.so
    arm64 lib/arm64-v8a/libmonodroid.so
    arm64 lib/arm64-v8a/libmonosgen-2.0.so
    arm64 lib/arm64-v8a/libsonivox.so
    armv7 lib/armeabi-v7a/lib_sqlite3.so
    armv7 lib/armeabi-v7a/libgdserver.so
    armv7 lib/armeabi-v7a/libmono-profiler-log.so
    armv7 lib/armeabi-v7a/libmonodroid.so
    armv7 lib/armeabi-v7a/libmonosgen-2.0.so
    armv7 lib/armeabi-v7a/libsonivox.so

    So it's aware of the library despite saying it can't find it. The console is flooded with "not found" messages. But there are also "namespace" errors like this:

    [linker] library "/system/lib/libsonivox.so" ("/system/lib/libsonivox.so") needed or dlopened by "/data/app/Mono.Android.DebugRuntime-1/lib/arm64/libmonosgen-64bit-2.0.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/com.app.smv-1/lib/arm64:/system/fake-libs64:/data/app/com.app.smv-1/base.apk!/lib/arm64-v8a", permitted_paths="/data:/mnt/expand:/data/data/com.app.smv"]

    Maybe it does find it but there is further conflict?

  • pmhart83pmhart83 USMember ✭✭✭

    I have gotten farther, it seems to find the SO file now:

    [mono-rt] Stacktrace:
    [mono-rt] 
    [mono-rt] /proc/self/maps:
    [mono-rt] 12c00000-12caa000 rw-p 00000000 00:04 11623                              /dev/ashmem/dalvik-main space (deleted)
    [mono-rt] 12caa000-1301c000 rw-p 000aa000 00:04 11623                              /dev/ashmem/dalvik-main space (deleted)
    [mono-rt] 1301c000-32c00000 ---p 0041c000 00:04 11623                              /dev/ashmem/dalvik-main space (deleted)
    [mono-rt] 32c00000-32c01000 rw-p 00000000 00:04 11624                              /dev/ashmem/dalvik-main space 1 (deleted)
    [mono-rt] 32c01000-52c00000 ---p 00001000 00:04 11624                              /dev/ashmem/dalvik-main space 1 (deleted)
    [mono-rt] 70ded000-7108d000 rw-p 00000000 fd:02 31831                              /data/dalvik-cache/arm64/[email protected]@boot.art
    [mono-rt] 7108d000-71209000 rw-p 00000000 fd:02 31837                              /data/dalvik-cache/arm64/[email protected]@boot-core-libart.art
    [mono-rt] 71209000-7123e000 rw-p 00000000 fd:02 31857                              /data/dalvik-cache/arm64/[email protected]@boot-conscrypt.art
    [mono-rt] 7123e000-71277000 rw-p 00000000 fd:02 31859                              /data/dalvik-cache/arm64/[email protected]@boot-okhttp.art
    [mono-rt] 71277000-7127a000 rw-p 00000000 fd:02 31881                              /data/dalvik-cache/arm64/[email protected]@boot-core-junit.art
    [mono-rt] 7127a000-712c0000 rw-p 00000000 fd:02 31889                              /data/dalvik-cache/arm64/[email protected]@boot-bouncycastle.art
    [mono-rt] 712c0000-71302000 rw-p 00000000 fd:02 31896                              /data/dalvik-cache/arm64/[email protected]@boot-ext.art
    [mono-rt] 71302000-71abd000 rw-p 00000000 fd:02 31909                              /data/dalvik-cache/arm64/[email protected]@boot-framework.art
    [mono-rt] 71abd000-71b4d000 rw-p 00000000 fd:02 31926                              /data/dalvik-cache/arm64/[email protected]@boot-telephony-common.art
    [mono-rt] 71b4d000-71b55000 rw-p 00000000 fd:02 31939                              /data/dalvik-cache/arm64/[email protected]@boot-voip-common.art
    [mono-rt] 71b55000-71b61000 rw-p 00000000 fd:02 31958                              /data/dalvik-cache/arm64/[email protected]@boot-ims-common.art
    [mono-rt] 71b61000-71b84000 rw-p 00000000 fd:02 31965                              /data/dalvik-cache/arm64/[email protected]@boot-apache-xml.art
    [mono-rt] 71b84000-71bab000 rw-p 00000000 fd:02 31970                              /data/dalvik-cache/arm64/[email protected]@boot-org.apache.http.legacy.boot.art
    [mono-rt] 71bab000-720f8000 r--p 00000000 fd:00 896                                /system/framework/arm64/boot.oat
    [mono-rt] 720f8000-724fb000 r-xp 0054d000 fd:00 896                                /system/framework/arm64/boot.oat
    [mono-rt] 724fb000-724fc000 r--p 00950000 fd:00 896                                /system/framework/arm64/boot.oat
    [mono-rt] 724fc000-724fd000 rw-p 00951000 fd:00 896                                /system/framework/arm64/boot.oat
    [mono-rt] 724fd000-7299d000 r--p 00000000 fd:00 880                                /system/framework/arm64/boot-core-libart.oat
    [mono-rt] 7299d000-72cb5000 r-xp 004a0000 fd:00 880                                /system/framework/arm64/boot-core-libart.oat
    [mono-rt] 72cb5000-72cb6000 r--p 007b8000 fd:00 880                                /system/framework/arm64/boot-core-libart.oat
    [mono-rt] 72cb6000-72cb7000 rw-p 007b9000 fd:00 880                                /system/framework/arm64/boot-core-libart.oat
    [mono-rt] 72cb7000-72d27000 r--p 00000000 fd:00 876                                /system/framework/arm64/boot-conscrypt.oat
    [mono-rt] 72d27000-72d80000 r-xp 00070000 fd:00 876                                /system/framework/arm64/boot-conscrypt.oat
    [mono-rt] 72d80000-72d81000 r--p 000c9000 fd:00 876                                /system/framework/arm64/boot-conscrypt.oat
    [mono-rt] 72d81000-72d82000 rw-p 000ca000 fd:00 876                                /system/framework/arm64/boot-conscrypt.oat
    [mono-rt] 72d82000-72e0c000 r--p 00000000 fd:00 888                                /system/framework/arm64/boot-okhttp.oat
    [mono-rt] 72e0c000-72e71000 r-xp 0008a000 fd:00 888                                /system/framework/arm64/boot-okhttp.oat
    [mono-rt] 72e71000-72e72000 r--p 000ef000 fd:00 888                                /system/framework/arm64/boot-okhttp.oat
    [mono-rt] 72e72000-72e73000 rw-p 000f0000 fd:00 888                                /system/framework/arm64/boot-okhttp.oat
    [mono-rt] 72e73000-72e7c000 r--p 00000000 fd:00 878                                /system/framework/arm64/boot-core-junit.oat
    [mono-rt] 72e7c000-72e7f000 r-xp 00009000 fd:00 878                                /system/framework/arm64/boot-core-junit.oat
    [mono-rt] 72e7f000-72e80000 r--p 0000c000 fd:00 878                                /system/framework/arm64/boot-core-junit.oat
    [mono-rt] 72e80000-72e81000 rw-p 0000d000 fd:00 878                                /system/framework/arm64/boot-core-junit.oat
    [mono-rt] 72e81000-72fec000 r--p 00000000 fd:00 874                                /system/framework/arm64/boot-bouncycastle.oat
    [mono-rt] 72fec000-73034000 r-xp 0016b000 fd:00 874                                /system/framework/arm64/boot-bouncycastle.oat
    [mono-rt] 73034000-73035000 r--p 001b3000 fd:00 874                                /system/framework/arm64/boot-bouncycastle.oat
    [mono-rt] 73035000-73036000 rw-p 001b4000 fd:00 874                                /system/framework/arm64/boot-bouncycastle.oat
    [mono-rt] 73036000-73153000 r--p 00000000 fd:00 882                                /system/framework/arm64/boot-ext.oat
    [mono-rt] 73153000-73197000 r-xp 0011d000 fd:00 882                                /system/framework/arm64/boot-ext.oat
    [mono-rt] 73197000-73198000 r--p 00161000 fd:00 882                                /system/framework/arm64/boot-ext.oat
    [mono-rt] 73198000-73199000 rw-p 00162000 fd:00 882                                /system/framework/arm64/boot-ext.oat
    ...
    [libc] Fatal signal 11 (SIGSEGV), code 1, fault addr 0x5620 in tid 20128 (Threadpool work)
    
  • pmhart83pmhart83 USMember ✭✭✭
    edited March 2017

    I used "adb pull" to grab the libsonivox.so file that is shipped with this device located at "/system/lib/libsonivox.so".

    But now I am getting an error saying the lib I am trying to use is 32 bit not 64 bit. Is it possible to use a 32 bit native library / .SO file in a arm64-v8a build?

Sign In or Register to comment.