Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load 'libmain.so', the application will terminate. #125

Closed
Auties00 opened this issue Apr 1, 2020 · 12 comments
Closed

Failed to load 'libmain.so', the application will terminate. #125

Auties00 opened this issue Apr 1, 2020 · 12 comments

Comments

@Auties00
Copy link

Auties00 commented Apr 1, 2020

Hello,
I'm developing a camera app and I chose to use Unity 3D to develop AR Face Filters with the help of the HyprFace SDK. The Unity 3D Project is successfully compiled, but the mist interesting part is that the Unity3D native app for Android works perfectly, while the one using Flutter and your plugin crashes with following message:

E/Unity ( 7759): Failed to load 'libmain.so', the application will terminate.
E/flutter ( 7759): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/base.apk"],nativeLibraryDirectories=[/data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/lib/arm64, /data/app/it
.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64]]] couldn't find "libmain.so"
E/flutter ( 7759): at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
E/flutter ( 7759): at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
E/flutter ( 7759): at java.lang.System.loadLibrary(System.java:1668)
E/flutter ( 7759): at com.unity3d.player.UnityPlayer.(Unknown Source:13)
E/flutter ( 7759): at com.rexraphael.flutterunitywidget.UnityUtils$1.run(UnityUtils.java:55)
E/flutter ( 7759): at android.app.Activity.runOnUiThread(Activity.java:7158)
E/flutter ( 7759): at com.rexraphael.flutterunitywidget.UnityUtils.createPlayer(UnityUtils.java:50)
E/flutter ( 7759): at com.rexraphael.flutterunitywidget.FlutterUnityView.getUnityView(FlutterUnityView.java:103)
E/flutter ( 7759): at com.rexraphael.flutterunitywidget.FlutterUnityView.(FlutterUnityView.java:30)
E/flutter ( 7759): at com.rexraphael.flutterunitywidget.FlutterUnityViewFactory.create(FlutterUnityViewFactory.java:34)
E/flutter ( 7759): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:176)
E/flutter ( 7759): at android.app.Dialog.dispatchOnCreate(Dialog.java:579)
E/flutter ( 7759): at android.app.Dialog.show(Dialog.java:397)
E/flutter ( 7759): at android.app.Presentation.show(Presentation.java:250)
E/flutter ( 7759): at io.flutter.plugin.platform.VirtualDisplayController.(VirtualDisplayController.java:93)
E/flutter ( 7759): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:46)
E/flutter ( 7759): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:112)
E/flutter ( 7759): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:95)
E/flutter ( 7759): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/flutter ( 7759): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226)
E/flutter ( 7759): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter ( 7759): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631)
E/flutter ( 7759): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 7759): at android.os.MessageQueue.next(MessageQueue.java:363)
E/flutter ( 7759): at android.os.Looper.loop(Looper.java:173)
E/flutter ( 7759): at android.app.ActivityThread.main(ActivityThread.java:8147)
E/flutter ( 7759): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 7759): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
E/flutter ( 7759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
E/flutter ( 7759):
F/flutter ( 7759): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
F/libc ( 7759): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7759 (.video_recorder), pid 7759 (.video_recorder)


Build fingerprint: 'HUAWEI/MAR-LX1AEEA/HWMAR:10/HUAWEIMAR-L21A/10.0.0.193C431:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2020-04-01 16:55:11+0200
pid: 7759, tid: 7759, name: .video_recorder >>> it.auties.video_recorder <<<
uid: 10593
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
'
x0 0000000000000000 x1 0000000000001e4f x2 0000000000000006 x3 0000007fce3f9e20
x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 7f7f7f7f7f7f7f7f
x8 00000000000000f0 x9 f8ef49a9baab1c36 x10 0000000000000001 x11 0000000000000000
x12 fffffff0fffffbdf x13 0000000000000003 x14 0000000000000001 x15 ffffffffffffffff
x16 00000076b0f29908 x17 00000076b0f09190 x18 00000076b434e000 x19 0000000000001e4f
x20 0000000000001e4f x21 00000000ffffffff x22 000000762e2667a0 x23 0000007613bf61d8
x24 0000000000000051 x25 00000076b3b13020 x26 0000000000000000 x27 0000000000000001
x28 0000000000000051 x29 0000007fce3f9ec0
sp 0000007fce3f9e00 lr 00000076b0ebe040 pc 00000076b0ebe06c
backtrace:
#00 pc 000000000006f06c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 2f04208be3c24ae761428c0bcfa6bcdf)
#1 pc 0000000001286340 /data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/lib/arm64/libflutter.so!libflutter.so (offset 0x1270000) (BuildId: f4265eefd53eea28f56b7c70057108036f657a07)
#2 pc 0000000001277134 /data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/lib/arm64/libflutter.so!libflutter.so (offset 0x1270000) (BuildId: f4265eefd53eea28f56b7c70057108036f657a07)
#3 pc 000000000127560c /data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/lib/arm64/libflutter.so!libflutter.so (offset 0x1270000) (BuildId: f4265eefd53eea28f56b7c70057108036f657a07)
#4 pc 00000000012c3e50 /data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/lib/arm64/libflutter.so!libflutter.so (offset 0x1270000) (BuildId: f4265eefd53eea28f56b7c70057108036f657a07)
#5 pc 0000000001286c44 /data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/lib/arm64/libflutter.so!libflutter.so (offset 0x1270000) (BuildId: f4265eefd53eea28f56b7c70057108036f657a07)
#6 pc 000000000128b7b0 /data/app/it.auties.video_recorder-38fsW7GIaolSVrCakfaemw==/lib/arm64/libflutter.so!libflutter.so (offset 0x1270000) (BuildId: f4265eefd53eea28f56b7c70057108036f657a07)
#7 pc 0000000000017d8c /system/lib64/libutils.so (android::Looper::pollInner(int)+856) (BuildId: 868b138f3e4abfebd8910c8133e83b50)
#8 pc 0000000000017994 /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+56) (BuildId: 868b138f3e4abfebd8910c8133e83b50)
#9 pc 000000000016323c /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44) (BuildId: 7a277d2d163ee525f6796737645c415c)
#10 pc 00000000002edd4c /system/framework/arm64/boot-framework.oat (art_jni_trampoline+140) (BuildId: 70275881a06e870ea0bf132171906cc63390c9d3)
#11 pc 0000000000144334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 756bb09899d855cad5160602c742fb8f)
#12 pc 00000000001531a4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+252) (BuildId: 756bb09899d855cad5160602c742fb8f)
#13 pc 00000000002eed0c /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 756bb09899d855cad5160602c742fb8f)
#14 pc 00000000002e9fdc /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+912) (BuildId: 756bb09899d855cad5160602c742fb8f)
#15 pc 00000000005bd25c /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+400) (BuildId: 756bb09899d855cad5160602c742fb8f)
#16 pc 000000000013e914 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 756bb09899d855cad5160602c742fb8f)
#17 pc 000000000034ae6a /system/framework/framework.jar (android.os.MessageQueue.next+34)
#18 pc 00000000005bb1c0 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1432) (BuildId: 756bb09899d855cad5160602c742fb8f)
#19 pc 000000000013e814 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 756bb09899d855cad5160602c742fb8f)
#20 pc 0000000000349e7e /system/framework/framework.jar (android.os.Looper.loop+130)
#21 pc 00000000005bdd68 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+1136) (BuildId: 756bb09899d855cad5160602c742fb8f)
#22 pc 000000000013e994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 756bb09899d855cad5160602c742fb8f)
#23 pc 00000000001a71ae /system/framework/framework.jar (android.app.ActivityThread.main+410)
#24 pc 00000000002bf948 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.8053280095303785888+240) (BuildId: 756bb09899d855cad5160602c742fb8f)
#25 pc 00000000005a609c /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 756bb09899d855cad5160602c742fb8f)
#26 pc 000000000014d468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 756bb09899d855cad5160602c742fb8f)
#27 pc 00000000001445b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 756bb09899d855cad5160602c742fb8f)
#28 pc 00000000001531c4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+284) (BuildId: 756bb09899d855cad5160602c742fb8f)
#29 pc 00000000004c6b6c /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) (BuildId: 756bb09899d855cad5160602c742fb8f)
#30 pc 00000000004c8594 /apex/com.android.runtime/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1476) (BuildId: 756bb09899d855cad5160602c742fb8f)
#31 pc 00000000004557fc /apex/com.android.runtime/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52) (BuildId: 756bb09899d855cad5160602c742fb8f)
#32 pc 00000000000f7c34 /system/framework/arm64/boot.oat (art_jni_trampoline+180) (BuildId: e5c4a287ed7a598c5e3443275f546efbe999d6b8)
#33 pc 0000000000144334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 756bb09899d855cad5160602c742fb8f)
#34 pc 00000000001531a4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+252) (BuildId: 756bb09899d855cad5160602c742fb8f)
#35 pc 00000000002eed0c /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 756bb09899d855cad5160602c742fb8f)
#36 pc 00000000002e9fdc /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+912) (BuildId: 756bb09899d855cad5160602c742fb8f)
#37 pc 00000000005baeb0 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+648) (BuildId: 756bb09899d855cad5160602c742fb8f)
#38 pc 000000000013e814 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 756bb09899d855cad5160602c742fb8f)
#39 pc 00000000003a2862 /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
#40 pc 00000000002bf948 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.8053280095303785888+240) (BuildId: 756bb09899d855cad5160602c742fb8f)
#41 pc 00000000005a609c /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 756bb09899d855cad5160602c742fb8f)
#42 pc 000000000014d468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 756bb09899d855cad5160602c742fb8f)
#43 pc 0000000000b1b674 /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2596) (BuildId: 70275881a06e870ea0bf132171906cc63390c9d3)
#44 pc 00000000001445b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 756bb09899d855cad5160602c742fb8f)
#45 pc 00000000001531c4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+284) (BuildId: 756bb09899d855cad5160602c742fb8f)
#46 pc 00000000004c6b6c /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) (BuildId: 756bb09899d855cad5160602c742fb8f)
#47 pc 00000000004c67d8 /apex/com.android.runtime/lib64/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+408) (BuildId: 756bb09899d855cad5160602c742fb8f)
#48 pc 00000000003c60fc /apex/com.android.runtime/lib64/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+636) (BuildId: 756bb09899d855cad5160602c742fb8f)
#49 pc 00000000000e25c4 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116) (BuildId: 7a277d2d163ee525f6796737645c415c)
#50 pc 00000000000e5aa4 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vectorandroid::String8 const&, bool)+828) (BuildId: 7a277d2d163ee525f6796737645c415c)
#51 pc 00000000000034e0 /system/bin/app_process64 (main+1168) (BuildId: 2f5c71b6655dcef8c8c732154da78dd1)
#52 pc 000000000006a050 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 2f04208be3c24ae761428c0bcfa6bcdf)

@Auties00
Copy link
Author

Auties00 commented Apr 1, 2020

Small update, I tried to build the flutter app and the native one to an apk and confronted the results, it looks like mainlib.so is really missing from the flutter one, but not from the native

@juicycleff
Copy link
Owner

You need to link the libs manually for AR Core. Read the docs

@EhsanBrd
Copy link

EhsanBrd commented Jun 9, 2020

You need to link the libs manually for AR Core. Read the docs

same error in here Can you help me please.
i stuck on in about 2 week !

@LucasTejero
Copy link

@juicycleff i follow all the steps in the docs,but i have the same issue.Can you help us?

@jamontes79
Copy link

I have the same problem

@klepov
Copy link

klepov commented Jul 24, 2020

same problem

@hardik-intellify
Copy link

I am facing the same issue. Please help.

@MugOfPaul
Copy link

@hardik-intellify @klepov @jamontes79 @LucasTejero @EhsanBrd

Unity -> Player Settings -> Android tab -> Other Settings -> Target Architectures and ensure ARM64 option is checked. This solved it for me.

@PARITOSH512
Copy link

PARITOSH512 commented Dec 1, 2020

this is not working for me

@IamBiswajitSahoo
Copy link

The issue seems to be with the Emulator being running on an x86 architecture CPU, while actual android devices runs on ARM based architecture. That's why the .so file was unable to run on the emulator and crashes.
(found from here: #88)

Try running the same app, on a physical android device instead.
If that works, it's great, if didn't, please post a reply with the error/stack trace of the same, will try to resolve.

However, of course as as a developer you would want to use the emulator for testing purpose. For that a bit of google took me to this page where you could use the latest Android 11 image that helps automatically convert ARM instructions to x86.

But it didn't work out for me. So if anyone finds a solution for the same please reply.

@Altaf-jg
Copy link

It doesnt work for mono builds. Works only for IL2CPP builds.
But, with Il2CPP builds, we do not get line numbers in log. That makes it very difficult to debug.
Any way we can make a mono build work?

@nikhilverma360
Copy link

@Auties00 do you have hyprface sdk?
I can't find it on internet. Can you give me?
Please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests