Closed Arham-Aalam closed 2 years ago
See https://github.com/homuler/MediaPipeUnityPlugin/wiki/Installation-Guide#dllnotfoundexception No.2.
Maybe you've not specified api_level
(this is not set by default now).
Note that this kind of problem is almost impossible to identify the cause unless you have the actual device, so you need to debug it by yourself (cf. https://github.com/homuler/MediaPipeUnityPlugin/issues/171#issuecomment-849259935).
Yes, I just found this issue.
Hi @homuler,
I tried building with ndk setting api_level = 21
but it doesn't work for me.
But after some work around I found something shocking!
I built AAR again from MediapipeUnityPlugin v0.8.0 and then put it inside MediapipeUnityPlugin v0.7.0 then built apk and it was working perfectly fine on all the devices I run with.
Just wondering if there is something wrong with MediapipeUnityPlugin v0.8.0+
thanks.
OK, please tell me your environment first (use build-installation-issue template).
And again, I cannot figure out the cause from the following poor error message.
2021/12/09 13:14:12.173 13325 13432 Error Unity DllNotFoundException: mediapipe_jni
So please load libmediapipe_jni.so
by yourself and check why the loader cannot load the library (cf. https://github.com/homuler/MediaPipeUnityPlugin/issues/372#issuecomment-989626714).
Here's sample code.
using (var system = new AndroidJavaClass("java.lang.System"))
{
system.CallStatic("loadLibrary", "mediapipe_jni");
}
Hi @homuler Sorry for late reply. I have used the Docker container for Linux to build the Android AAR with this command: No change in config except api_level=21
python build.py build --android arm64 -vv
I just produced a log for the above code. here's what I got:
2021/12/16 15:13:10.057 8810 8835 Error Unity AndroidJavaException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libmediapipe_jni.so" not found
2021/12/16 15:13:10.057 8810 8835 Error Unity java.lang.UnsatisfiedLinkError: dlopen failed: library "libmediapipe_jni.so" not found
2021/12/16 15:13:10.057 8810 8835 Error Unity at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
2021/12/16 15:13:10.057 8810 8835 Error Unity at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
2021/12/16 15:13:10.057 8810 8835 Error Unity at java.lang.System.loadLibrary(System.java:1664)
2021/12/16 15:13:10.057 8810 8835 Error Unity at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
2021/12/16 15:13:10.057 8810 8835 Error Unity at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
2021/12/16 15:13:10.057 8810 8835 Error Unity at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
2021/12/16 15:13:10.057 8810 8835 Error Unity at android.os.Handler.dispatchMessage(Handler.java:102)
2021/12/16 15:13:10.057 8810 8835 Error Unity at android.os.Looper.loop(Looper.java:236)
2021/12/16 15:13:10.057 8810 8835 Error Unity at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
2021/12/16 15:13:10.057 8810 8835 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x0008d] in /Users/bokken/buildslave/unity/build/Modules/AndroidJNI/AndroidJNISafe.cs:24
2021/12/16 15:13:10.057 8810 8835 Error Unity at UnityEngine.AndroidJNISafe.CallStaticVoidMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x0000f] in /Users/bokken/buildslave/uni
Note: Load on startup is checked for the AAR.
Can you confirm that your APK contains libmediapipe_jni.so
?
P.S. By the way, you don't need to check Load on startup
. I don't think it makes differences in this case, though.
Nope, no such file there, but APKs built with v0.7.0 has libmediapipe_jni.so
under lib>arm64-v8a
folder.
Then the cause is now quite obvious.
I imported everything in separate project and it is working fine on PC.
How did you do that? I mean, as I've said many times before, use build-installation-issue template to describe the issue.
Here is how I use it in separate project:
I copied following folders:
Mediapipe
SteamingAssets
Packages > com.github.homuler.mediapipe
Ans deleted unnecessary graphs except Pose Tracking
folder.
I also imported Image Source
and Bootstrap
and made Pose Tracking.unity
the primary scene in the build settings.
then commented these lines:
https://github.com/homuler/MediaPipeUnityPlugin/blob/702434d58e78f28702e952f9f35ee6eaaa2d4afb/Assets/Mediapipe/Samples/Common/Scripts/Bootstrap.cs#L44
https://github.com/homuler/MediaPipeUnityPlugin/blob/702434d58e78f28702e952f9f35ee6eaaa2d4afb/Assets/Mediapipe/Samples/Common/Scripts/Bootstrap.cs#L108-L110
├───Assets
│ ├───Mediapipe
│ │ ├───Editor
│ │ └───Samples
│ │ ├───Common
│ │ │ └───Scripts
│ │ │ └───ImageSource
│ │ ├───Materials
│ │ ├───Scenes
│ │ │ └───Pose Tracking
│ │ │ └───Pose Tracking
│ │ └───UI
│ │ ├───Objects
│ │ │ └───Console
│ │ └───Scripts
│ ├───Scenes
│ └───StreamingAssets
├───Packages
│ └───com.github.homuler.mediapipe
│ ├───Runtime
│ │ ├───Materials
│ │ ├───Objects
│ │ ├───Plugins
│ │ │ ├───Android
│ │ │ ├───iOS
│ │ │ │ └───MediaPipeUnity.framework
│ │ │ ├───OpenCV
│ │ │ └───Protobuf
│ │ ├───Resources
│ │ ├───Scripts
│ │ │ ├───Core
│ │ │ ├───External
│ │ │ ├───Framework
│ │ │ │ ├───Formats
│ │ │ │ ├───Packet
│ │ │ │ ├───Port
│ │ │ │ └───Tool
│ │ │ ├───Gpu
│ │ │ ├───Graphs
│ │ │ │ └───InstantMotionTracking
│ │ │ ├───PInvoke
│ │ │ │ └───NativeMethods
│ │ │ │ ├───External
│ │ │ │ ├───Framework
│ │ │ │ │ └───Format
│ │ │ │ ├───Gpu
│ │ │ │ ├───Graphs
│ │ │ │ └───Util
│ │ │ ├───Protobuf
│ │ │ ├───Unity
│ │ │ │ ├───Annotation
│ │ │ │ └───CoordinateSystem
│ │ │ └───Util
│ │ └───Shaders
│ └───Tests
│ └───EditMode
│ ├───Framework
│ │ ├───Format
│ │ ├───Packet
│ │ ├───Port
│ │ └───Tool
│ ├───Gpu
│ └───Unity
│ └───CoordinateSystem
├───Library
├───ProjectSettings
└───UserSettings
Thanks for the guidance I think I missed something. If I am missing anything then let me know? I can also try to remove stuff one by one from the official project to check what is missing.
WRITE YOUR ENVIRONMENT INFORMATION FIRST (https://github.com/homuler/MediaPipeUnityPlugin/issues/372#issuecomment-995646347).
At the moment, I can think of the following possibilities.
Packages/packages-lock.json
.Packages/com.github.homuler.mediapipe/Runtime/Plugins/Android/mediapipe_android.aar
is not copied (or is not built in the first place).mediapipe_android.aar
is not configured correctly.
mediapipe_android.aar
, mediapipe_android.aar.meta
should have been removed by UnityEditor.Thanks @homuler
It was an Android config issue for arm64
also latest Mediapipe version is working fine with huawei phones
as well.
Thanks for V0.8.2
I am running the latest version(v0.8.0) in android. I imported everything in separate project and it is working fine on PC. When I run the apk in my phone (MI note 9 pro) it gives me this error:
It says the issue is in
Bootstrap.cs:48
The error is comming from this line:GlobalConfigManager.SetFlags();
Also the AAR was built using Linux Docker and it was working fine with official sample.