Open BoHellgren opened 6 months ago
The medipipe/examples/objectdetection app also crashes when run on an emulator with API > 30. It seems that x86 images are OK, but x86_64 images are not. Then this app crashes because libmediapipe_tasks_vision_jni.so cannot be found. This crash comes at CameraFragment.kt:135
Hi @schmidt-sebastian,
It appears to be similar to the issue https://github.com/google/mediapipe/issues/5100, which has already been reported and is causing crashes on Android emulators. Could you please investigate this issue as well?
Thank you!!!
I downloaded your sample program medipipe/examples/objectdetection and made only two small changes, to app build.gradle:
2024-02-12 12:52:47.477 32148-32180 AndroidRuntime com...pipe.examples.objectdetection E FATAL EXCEPTION: pool-2-thread-1
Process: com.google.mediapipe.examples.objectdetection, PID: 32148
java.lang.UnsatisfiedLinkError: dlopen failed: library "libmediapipe_tasks_vision_jni.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
at java.lang.Runtime.loadLibrary0(Runtime.java:998)
at java.lang.System.loadLibrary(System.java:1656)
at com.google.mediapipe.tasks.vision.objectdetector.ObjectDetector.<clinit>(ObjectDetector.java:117)
at com.google.mediapipe.tasks.vision.objectdetector.ObjectDetector.createFromOptions(ObjectDetector.java:178)
at com.google.mediapipe.examples.objectdetection.ObjectDetectorHelper.setupObjectDetector(ObjectDetectorHelper.kt:125)
at com.google.mediapipe.examples.objectdetection.ObjectDetectorHelper.<init>(ObjectDetectorHelper.kt:53)
at com.google.mediapipe.examples.objectdetection.fragments.CameraFragment.onViewCreated$lambda-3(CameraFragment.kt:133)
at com.google.mediapipe.examples.objectdetection.fragments.CameraFragment.$r8$lambda$quxn3nvY7rt-pHwnK2X4H22loyQ(Unknown Source:0)
at com.google.mediapipe.examples.objectdetection.fragments.CameraFragment$$ExternalSyntheticLambda11.run(Unknown Source:2)
If I look at the APK file, both debug and release, there is a libmediapipe_tasks_vision_jni.so for x86, arm64-v8a, and arme-abiv7a, but not for x86_64. Have you for some reason not compiled MediaPipe for this architecture??
This bug stops me from releasing my new app since I cannot test it properly. I would be grateful if you fix this asap.
f I look at the APK file, both debug and release, there is a libmediapipe_tasks_vision_jni.so for x86, arm64-v8a, and arme-abiv7a, but not for x86_64. Have you for some reason not compiled MediaPipe for this architecture??
This bug stops me from releasing my new app since I cannot test it properly. I would be grateful if you fix this asap.
Den mån 12 feb. 2024 kl 09:36 skrev kuaashish @.***>:
Hi @schmidt-sebastian https://github.com/schmidt-sebastian,
It appears to be similar to the issue #5100 https://github.com/google/mediapipe/issues/5100, which has already been reported and is causing crashes on Android emulators. Could you please investigate this issue as well?
Thank you!!!
— Reply to this email directly, view it on GitHub https://github.com/google/mediapipe/issues/5134#issuecomment-1938235840, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEN5JJLXELYQBNRYKM46OOTYTHIBJAVCNFSM6AAAAABDC2CDX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZYGIZTKOBUGA . You are receiving this because you authored the thread.Message ID: @.***>
@schmidt-sebastian When can you look at this?
Hi @BoHellgren,
We have identified that using an emulator to run this program might not be ideal due to hardware limitations and the program's reliance on specific hardware features for optimal performance. Using a physical device is highly recommended for the best experience and functionality.
Because, Machine learning programs often require direct interaction with real-world hardware resources to function effectively. Emulators, while valuable for development and testing, may not provide the necessary hardware capabilities for this program to run smoothly. Unfortunately, due to limitations, We can not do much about this issue.
Thank you!!
I agree that testing ML apps in an emulator has its problems. For example, to test your Object Detection sample program, one has to use Extended Controls to mount an image on a wall in the emulated apartment, and then use mouse and QWERASDF keys to move the emulated camera to face the wall with the photo. This does not mean that testing on emulators is useless. On the contrary, unless you have a lot of physical devices, emulators are the only way to test that your app runs on all API levels. Testing on Firebase Test Lab is not an alternative for ML apps, since you then don't have any control of the camera whatsoever.
I am convinced that you can make MediaPipe run on emulators if you want to, and I urge you to fix this. I think many developers will say no thanks to MediaPipe if they hear that you only support testing on real devices.
Unfortunately, due to limitations, We can not do much about this issue.
@kuaashish When added via gradle mediapipe literally provides x86 library and does not provide x86_64.
It would crash on a real hardware x64 device. This crash is not due emulator limitations, this is due the missing jni library, lol.
Have you even read the issue, or did you just generated your response using ChatGPT?
Hi @schmidt-sebastian,
Could you please have look into this issue?
Thank you!!
Did anyone find any solution to this problem ?
I have tried hand gesture example on s23 ultra running on android 14 and I get the same error basically any device having SDK > 30 gives same error i.e jni file not found.
@kuaashish @schmidt-sebastian There are real devices with x86_64 architecture, such as the ASUS ZenFone Series and Lenovo K900. Do you have plans to support these devices?
Additionally, the absence of libmediapipe_tasks_vision_jni.so for x86_64 can result in rejection when publishing to the Google Play Store. What solutions do you suggest for this issue?
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
Android 11, 12, 13
Mobile device if the issue happens on mobile device
Emulated Pixel 5
Browser and version if the issue happens on browser
No response
Programming Language and version
Kotlin
MediaPipe version
implementation 'com.google.mediapipe:tasks-vision:latest.release'
Bazel version
No response
Solution
Object Detection
Android Studio, NDK, SDK versions (if issue is related to building in Android environment)
No response
Xcode & Tulsi version (if issue is related to building for iOS)
No response
Describe the actual behavior
Fatal exception if API level > 30
Describe the expected behaviour
To work as it does on API level 30
Standalone code/steps you may have used to try to get what you need
Other info / Complete Logs