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

Android - Error Unity DllNotFoundException: Unable to load DLL 'mediapipe_jni' #269

Closed
gkiernozek opened this issue Sep 6, 2021 · 2 comments
Labels
platform:android Issue that occurs when the target platform is Android type:build/install Cannot build/install the plugin

Comments

@gkiernozek
Copy link
Contributor

gkiernozek commented Sep 6, 2021

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 20.04): Microsoft Windows [Version 10.0.19042.1165]
  • Target Platform: Android
  • Mobile Device (if the target is Android or iOS): Samsung Galaxy S7
  • MediaPipeUnityPlugin version or commit id: d58ab72
  • Bazel version: -
  • GCC/G++ version: -
  • Android NDK version (if the target platform is Android): 19.0.5232133
  • Xcode version (if the target platform is iOS):

Describe the current behavior
I've built all dll's with docker, everything started to work on Windows, but when I build to Android it does not work on my Galaxy S7. Error that I get is:
image

and

image

when using ADB to see what happens.

Is there any tips for this @homuler?
mediapipe_android.aar looks fine after building and it works on Desktop. I have Load on startup enabled on libmediapipe_c.dll and opencv_world3410.dll.
I have "Use GPU" marked as well when building for Android.

I have only those in Streaming Assets, and not much more assetbundles, but nothing else appears when I do Assets>Build AssetBundles:
image

I also have those libs in .apk:
image

@gkiernozek
Copy link
Contributor Author

gkiernozek commented Sep 6, 2021

For everyone having this problem in the future -

It was a two-stepper so pretty hard to find and combine but here it is:

Before you build android library with docker you need to edit WORKSPACE file to include NDK api_level like this (according to this comment: google-ai-edge/mediapipe#1224 (comment)) :

You may run setup_android.sh to install Android SDK and NDK.

android_ndk_repository(
name = "androidndk",
api_level = 21,
)

@homuler can we edit WORSPACE file like this ^ for everyone? I've submitted pull request for this :)

and another important thing is that to have proper assetbundles build is to have properly configured meta files of *.bytes files that you have in Packages\com.github.homuler.mediapipe\Runtime\Resources folder.
By proper I mean editing them from this (I have checked diff according to this comment: #119 (comment) and I noticed it has been removed on import):

fileFormatVersion: 2
guid: eccb5de6967da1d4b80280b079b3ec2b
TextScriptImporter:
  externalObjects: {}
  userData: 
  assetBundleName:
  assetBundleVariant: 

to this:

fileFormatVersion: 2
guid: eccb5de6967da1d4b80280b079b3ec2b
TextScriptImporter:
  externalObjects: {}
  userData: 
  assetBundleName: mediapipe
  assetBundleVariant: 

and then do Assets>Build AssetBundles from the menu and you should be good to go :)

@homuler
Copy link
Owner

homuler commented Sep 7, 2021

same as #171 (comment)

@homuler homuler added platform:android Issue that occurs when the target platform is Android type:build/install Cannot build/install the plugin labels Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:android Issue that occurs when the target platform is Android type:build/install Cannot build/install the plugin
Projects
None yet
Development

No branches or pull requests

2 participants