Crashes on Android due to error "libmain.so not found" with RN > 0.60
See original GitHub issueWhile everything works fine with React Native below any version under 0.60, on Android the application will crash upon activating the UnityView with RN > 0.60.
The final error happens because of a “libmain.so” could not be loaded:
E Unity : Failed to load 'libmain.so', the application will terminate.
D AndroidRuntime: Shutting down VM
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: com.rnunitydemo, PID: 16887
E AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.rnunitydemo-bKGyotdcwjVnBxuR9zLE4Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.rnunitydemo-bKGyotdcwjVnBxuR9zLE4Q==/lib/arm64, /data/app/com.rnunitydemo-bKGyotdcwjVnBxuR9zLE4Q==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]] couldn't find "libmain.so"
According to a crash-report in the official Unity-Forum, we took care to use the same settings in both build.gradle
for ndk-abiFilter:
android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
multiDexEnabled true
versionCode 1
versionName '0.1'
}
}
but it won’t fix the issue. There is a big chance that the issues https://github.com/f111fei/react-native-unity-view/issues/120 and https://github.com/f111fei/react-native-unity-view/issues/129 might be related to this one.
Anybody found a proper solution for this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
How to solve "libmain.so not found" while using Unity as a ...
I can answer by myself now. The issue was caused by Unity export that was not ARM64-compatible unless several settings were applied manually ......
Read more >App not working on some devices; Failed to load 'libmain.so'
I've been experiencing this "libmain.so" error on Android 9+ devices with Unity 2020.2.1f1 and 2020.2.2f1, while older Android versions were ...
Read more >android - React-Native :java.lang.UnsatisfiedLinkError: couldn't find ...
I have just updated my project to use react-native version 0.60.2 . But when I am trying to run an application on Android...
Read more >[Android] App installed using APK from app bundle option in ...
bugexportproject-9BuOMuJaMXjG4oK6dLN3SQ==/lib/arm/libmain.so" not found Press Ok to quit." Reproducible with: 2020.2.0a12, 2020.2.7f1, 2021.1.
Read more >Bluestacks 5 - "Your hardware does not support this ... - Reddit
Hi, I'm getting these error messages when I try to run a game. I downloaded the APK file directly instead of using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found it. Bevor building for Android, we need to adjust some settings in “Player Settings” in order to make ARM64 Bit available:
If you run into an Error like “NDK not found”, ensure that Unity has downloaded and installed its own copy of NDK:
Having all this in mind will enable us to link against these libraries without failing to find “libmain.so”
It works, thanks