bazel: mobile-install is failing on a python import error

Description of the problem / feature request:

I’m attempting to run bazel mobile-install for an android_binary target. The app is the simple hello world app generated by the single activity app base in Android Studio.

This is the incorrect output I’m seeing:

$ bazel mobile-install //app/src:app_binary --start_app --incremental

INFO: Analyzed target //app/src:app_binary (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/jeremymuhia/development/mono/android/app/src/BUILD:5:15: Installing //app/src:app_binary incrementally failed (Exit 1): incremental_install failed: error executing command bazel-out/darwin-py2-opt-exec-2B5CBBC6/bin/external/bazel_tools/tools/android/incremental_install --output_marker bazel-out/darwin-fastbuild/bin/app/src/app_binary_files/incremental_deploy_marker ... (remaining 10 argument(s) skipped)
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_jeremymuhia/f9dfbeb00953a93e3d2ab5498ee6f23d/execroot/__main__/bazel-out/darwin-py2-opt-exec-2B5CBBC6/bin/external/bazel_tools/tools/android/incremental_install.runfiles/bazel_tools/tools/android/incremental_install.py", line 25, in <module>
    from concurrent import futures
ImportError: No module named concurrent
Target //app/src:app_binary failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.270s, Critical Path: 0.11s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully

This seems peculiar because when I build an apk with bazel build //app/src:app_binary and install it manually with adb install bazel-bin/app/src/app_binary.apk, I can see that the app is installed on the device and is without any runtime errors.

Feature requests: what underlying problem are you trying to solve with this feature?

mobile-install does not seem to be working correctly. The incremental_install.py file seems to depend on a concurrent module/file that can’t be pip installed and doesn’t seem to be packaged with Bazel.

Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

This repo contains the source code for the template Android app. Cloning, navigating to the android directory, and executing bazel mobile-install //app/src:app_binary --start_app --incremental should reproduce the error.

What operating system are you running Bazel on?

macOS Catalina version 10.15.6

What’s the output of bazel info release?

release 3.7.2-homebrew

What’s the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

https://github.com/veganafro/mono.git
cefc78574a063a945098b01b70f4de5c385717ea
cefc78574a063a945098b01b70f4de5c385717ea

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 16 (3 by maintainers)

Most upvoted comments

The tool that’s crashing has been migrated to python3, so first check if installing python3 solves the issue if you don’t already have it installed.