mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Building Android example fails when deleting libmediapipe_jni.so

Open murilolima opened this issue 2 years ago • 5 comments

System information

  • OS Platform and Distribution: Ubuntu 20.04
  • Compiler version: g++ 9.4.0
  • Programming Language and version: C++ 17
  • MediaPipe version: 0.8.10.2
  • Bazel version: 5.2.0
  • Android SDK and NDK versions (if android):
    • Android SDK: https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
    • Android NDK: https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip
  • Android AAR ( if android): not using AAR
  • OpenCV version (if running on desktop): 4

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

murilolima avatar Sep 01 '22 16:09 murilolima

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!

kuaashish avatar Sep 02 '22 07:09 kuaashish

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.

murilolima avatar Sep 02 '22 11:09 murilolima

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

google-ml-butler[bot] avatar Sep 02 '22 11:09 google-ml-butler[bot]

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

kuaashish avatar Sep 08 '22 11:09 kuaashish

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

murilolima avatar Sep 08 '22 13:09 murilolima

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

kuaashish avatar Apr 26 '23 11:04 kuaashish

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] avatar May 04 '23 01:05 github-actions[bot]

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

github-actions[bot] avatar May 11 '23 01:05 github-actions[bot]

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

google-ml-butler[bot] avatar May 11 '23 01:05 google-ml-butler[bot]

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

murilolima avatar May 22 '23 13:05 murilolima