profile
viewpoint

Ask questionsBazel build failed in Android Studio

Hi, I followed the installation instruction of "Setting up Android Studio with MediaPipe". When I imported the bazel project, bazel build failed in Android Studio.

Android Studio: 3.5 SDK Platform 28 NDK 20.0.5594570 SDK Tools 26.1.1 SDK Platform-Tools 29.0.2 SDK Build-Tools 28.0.3

The following are the errors reported in the Bazel Console in Android Studio: ERROR: /private/var/tmp/_bazel_junyaoguo/fd64e915985bd32c3dd281a6a4d37a1c/external/androidsdk/BUILD.bazel:8:1: in @intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect aspect on android_sdk rule @androidsdk//:sdk-28: Traceback (most recent call last): File"/private/var/tmp/_bazel_junyaoguo/fd64e915985bd32c3dd281a6a4d37a1c/external/androidsdk/BUILD.bazel", line 8 @intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect(...)

File"/private/var/tmp/_bazel_junyaoguo/fd64e915985bd32c3dd281a6a4d37a1c/external/intellij_aspect/intellij_info_bundled.bzl", line 54, in _aspect_impl intellij_info_aspect_impl(target, ctx, semantics)

File"/private/var/tmp/_bazel_junyaoguo/fd64e915985bd32c3dd281a6a4d37a1c/external/intellij_aspect/intellij_info_impl.bzl", line 896, in intellij_info_aspect_impl collect_android_sdk_info(ctx, ide_info, ide_info_file, output_g...)

File"/private/var/tmp/_bazel_junyaoguo/fd64e915985bd32c3dd281a6a4d37a1c/external/intellij_aspect/intellij_info_impl.bzl", line 743, in collect_android_sdk_info list(ctx.rule.attr.android_jar.files) type 'depset' is not iterable. Use the to_list() method to get a list. Use --incompatible_depset_is_not_iterable=false to temporarily disable this check.

ERROR: /Users/junyaoguo/Documents/SVL_Projects/mediapipe/mediapipe/java/com/google/mediapipe/components/BUILD:60:1: no such package 'third_party/java/jsr305_annotations': BUILD file not found in any of the following directories.

  • /Users/junyaoguo/Documents/SVL_Projects/mediapipe/third_party/java/jsr305_annotations and referenced by '//mediapipe/java/com/google/mediapipe/components:android_microphone_helper' WARNING: errors encountered while analyzing target '//mediapipe/java/com/google/mediapipe/components:android_microphone_helper': it will not be built

Screen Shot 2019-08-21 at 3 10 21 PM

Also, I can't run the example on Android phone as instructed in the last step (step 8) in the installation manual. Could you please take a look?Thanks.

google/mediapipe

Answer questions jiuqiant

For the build error, the error message suggests that you need to append --incompatible_depset_is_not_iterable=false to the build command.

Please do

$ bazel clean --expunge
$ bazel build -c opt --config=android_arm64 --incompatible_depset_is_not_iterable=false mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu

I also recommend that you keep the version of your SDK Platform, SDK Platform-Tools, and SDK Build-Tools in sync, either 28 or 29.

Moreover, can you report what error you encounter in step 8?

useful!

Related questions

Get hand_tracking_cpu source code to extract detected hand metadata hot 2
SSL certification error while downloading dependency libraries via Bazel hot 1
Build of Hello World Failed on Darwin (MacOS) hot 1
Build of Hello World Failed on Darwin (MacOS) hot 1
Fail to pull in MediaPipe's external dependencies due to unstable internet connection hot 1
at com.google.mediapipe.apps.objectdetectioncpu.MainActivity.<clinit>(MainActivity.java:50) hot 1
Hand Tracking Desktop GPU Build Error hot 1
ERROR: An error occurred during the fetch of repository 'bazel_skylib' hot 1
Bazel build failed to fetch Maven dependency hot 1
Running error hot 1
Hello World failed build on Raspberry Pi - mediapipe hot 1
Accessing landmarks, tracking multiple hands, and enabling depth on desktop hot 1
Unable to load the hand detection model hot 1
build aar failed hot 1
Error in building TensorFlow Object Detection Demo hot 1
Github User Rank List