Unable to load library: libunity.so

found many crash in

Android 4.1.2,level 16 and

Android 4.2.2,level 17

Android 4.2.1,level 17

the log:
#00 pc 00045e98 /system/lib/libdvm.so (dvmAbort+75) [armeabi-v7a]
2 #01 pc 00001509 /data/data/com.xxx/lib/libmain.so [armeabi-v7a]
3 #02 pc 0001def0 /system/lib/libdvm.so (dvmPlatformInvoke+112) [armeabi-v7a]
4 #03 pc 0004d14b /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394) [armeabi-v7a]
5 #04 pc 00027320 /system/lib/libdvm.so [armeabi-v7a]
6 #05 pc 0002bc30 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180) [armeabi-v7a]
7 #06 pc 0005fb7f /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374) [armeabi-v7a]
8 #07 pc 0006712d /system/lib/libdvm.so [armeabi-v7a]
9 #08 pc 00027320 /system/lib/libdvm.so [armeabi-v7a]
10 #09 pc 0002bc30 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180) [armeabi-v7a]
11 #10 pc 0005f8b9 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272) [armeabi-v7a]
12 #11 pc 0004973b /system/lib/libdvm.so [armeabi-v7a]
13 #12 pc 0004c5b9 /system/lib/libandroid_runtime.so [armeabi-v7a]
14 #13 pc 0004d72f /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390) [armeabi-v7a]
15 #14 pc 00000dcf /system/bin/app_process [armeabi-v7a]
16 #15 pc 00017123 /system/lib/libc.so (__libc_init+38) [armeabi-v7a]
17 #16 pc 00000b34 /system/bin/app_process [armeabi-v7a]
java:
19 com.unity3d.player.UnityPlayer.a(Unknown Source)
20 com.unity3d.player.UnityPlayer.(Unknown Source)
21 com.xxx.UnityPlayerActivity.onCreate(UnityPlayerActivity.java:32)

the log below was in different device: the folder is all unsame.

E dalvikvm: JNI posting fatal error: Unable to load library: /mnt/asec/com.xxx-1/lib/libunity.so [Cannot load library: find_library[1201]: 150 ‘libunity.so’ failed to load previously]

JNI posting fatal error: Unable to load library: /data/app-lib/com.xxx-1/libunity.so [Cannot load library: find_library(linker.cpp:889): “libunity.so” failed to load previously]

JNI posting fatal error: Unable to load library: /data/data/xxx/lib/libunity.so [Cannot load library: find_library[1202]: 1737 ‘libunity.so’ failed to load previously]

someone can help? think you

asec means SD card storage, that’s a known issue on google side. See Native method not found: com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator:()V page-4 and search for ProjectGeneratorCallback.cs

@Tomas1856 my app is not build with app bundle , i not sure it is the same issue

the crash is only crash in this api levels:

Android 4.1.2,level 16 and

Android 4.2.2,level 17

Android 4.2.1,level 17

Hmph, well you could restrict your app to be only be install-able on internal storage, see Player Settings Install Location, Force Internal.

Without investigation, really hard to say

Same problem, started just recently, getting crashes on lower android api levels. Setting “Force Internal” does not help. Have you found a solution?

Found a solution: turns out the problem was in IL2CPP, building win Mono was fine. And I fixed IL2CPP build too, all I needed is to uncheck “Strip Engine Code” checkbox.
Unity version - 2019.2.9f1

2 Likes

That’s really strange…If you can, could you please submit us a bug with repro project attached?

Thank you

Im getting that exact same error in production as well for Android 4.1 (not sure if other Android versions)

EDIT: I didnt try to remove yet the Strip Engine Code to see if it fixes, will write again after more tests

Unchecking Strip Engine Code solved the problem for me as well

I created an empty project using LWRP template, changed to IL2CPP/.NET 4, almost everything else default, tried to run on a 4.1 device and it crashed. Unchecked Strip Engine Code and it worked.

Im on Unity 2019.2.9f1

Please submit a bug with repro project and steps attached. Thank you

It’s just an empty project, I cant see how this missed QA. In any case I have created the bug report (case 1193070).

I think the Android version plays important role here, most of Unity’s automated tests run on much higher Android version

Setting “Force Internal” does not help as well for me,i will try the Unchecked Strip Engine Code method

In 2019.3 Unity will bump Android Min API to 19, you could do the same in 2019.2, that would effectively eliminate your problem, it seems on Android 4.1 there might be missing some API that’s why it fails

I experienced the libunity.so failed to load on il2cpp android builds on 2019.2.9f1-2019.2.11f1.

2019.2.8f1 works fine. mono builds work fine. will investigate the strip engine code setting now.

in 2019.2.11f1, unchecking strip engine code does produce an il2cpp android build that does not crash on boot. it is 4665kb larger than the build with stripped engine code, however.

we’ve submitted a bug report with logs and repro steps and all that and are back to using 2019.2.8f1 for the immediate future.

we see a different crash on boot when stripping engine code on il2cpp builds in 2019.2.14f1.

11-29 00:11:23.290 26011 26088 E Unity : Cannot create web request without initializing the system
11-29 00:11:23.290 26011 26088 E Unity :
11-29 00:11:23.290 26011 26088 E Unity : (Filename: ./Modules/UnityWebRequest/Public/UnityWebRequestManager.cpp Line: 87)
11-29 00:11:23.290 26011 26088 E Unity : --------- beginning of crash
11-29 00:11:23.290 26011 26088 F libc : Fatal signal 5 (SIGTRAP), code -6 in tid 26088 (CloudJob.Worker)

we do not have unitywebrequest package enabled as we do not use it. we also do not touch cloudjobs, whatever those may be. no other build configuration that we have tested crashes on boot like this.

we are sticking with 2019.2.8f1, that appears to be the last version that produces stable android il2cpp player builds.