google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.52k stars 5.15k forks source link

Building Android example fails when deleting libmediapipe_jni.so #3655

Closed murilolima closed 1 year ago

murilolima commented 2 years ago

System information

Describe the problem: Building the Android example fails with the following error:

[...] mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu/BUILD:29:11: SolibSymlink _solib_arm64-v8a/_U_S_Smediapipe_Sexamples_Sandroid_Ssrc_Sjava_Scom_Sgoogle_Smediapipe_Sapps_Shandtrackinggpu_Cmediapipe_Ujni_Ulib___Umediapipe_Sexamples_Sandroid_Ssrc_Sjava_Scom_Sgoogle_Smediapipe_Sapps_Shandtrackinggpu/libmediapipe_jni.so failed: failed to delete output files before executing action Target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu failed to build

It works if I use bazel mobile-install.

Provide the exact sequence of commands / steps that you executed before running into the problem:

sed -i '/include\/opencv4/s/#//g' third_party/opencv_linux.BUILD
echo 'android_ndk_repository(name="androidndk", api_level=21)' >> WORKSPACE
echo 'android_sdk_repository(name="androidsdk")' >> WORKSPACE
bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu
kuaashish commented 2 years ago

Hi @murilolima, Could you please try with new approach using Gradle as mentioned here . Please refer to this thread #2339 and #2339(comment) for better understanding. Thank you!

murilolima commented 2 years ago

It worked with AndroidStudio, and as I mentioned above also with bazel mobile-install.

Is building with bazel build not recommended?

I suggest updating the MediaPipe in Android instructions accordingly.

google-ml-butler[bot] commented 2 years ago

Are you satisfied with the resolution of your issue? Yes No

kuaashish commented 2 years ago

Hi @murilolima, Could you please provide the complete error logs and steps to reproduce the issue. Thank you!

murilolima commented 2 years ago

I ran the following commands:

wget https://github.com/google/mediapipe/archive/refs/tags/v0.8.10.2.zip
unzip v0.8.10.2.zip 
cd mediapipe-0.8.10.2
sed -i '/include\/opencv4/s/#//g' third_party/opencv_linux.BUILD
echo 'android_ndk_repository(name="androidndk", api_level=21)' >> WORKSPACE
echo 'android_sdk_repository(name="androidsdk")' >> WORKSPACE
bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu

The logs are attached. command.log

kuaashish commented 1 year ago

Hello @murilolima, We are upgrading the MediaPipe Legacy Solutions to new MediaPipe solutions However, the libraries, documentation, and source code for all the MediapPipe Legacy Solutions will continue to be available in our GitHub repository and through library distribution services, such as Maven and NPM.

You can continue to use those legacy solutions in your applications if you choose. Though, we would request you to check new MediaPipe solutions which can help you more easily build and customize ML solutions for your applications. These new solutions will provide a superset of capabilities available in the legacy solutions. Thank you

github-actions[bot] commented 1 year ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 1 year ago

This issue was closed due to lack of activity after being marked stale for past 7 days.

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No

murilolima commented 1 year ago

The instructions still point to using blaze build and adb install in the Framework page.