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, Windows: mobile-install fails with Python3 #7580

Closed
laszlocsomor opened this issue Feb 28, 2019 · 1 comment
Closed

Android, Windows: mobile-install fails with Python3 #7580

laszlocsomor opened this issue Feb 28, 2019 · 1 comment
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Android Issues for Android team type: bug

Comments

@laszlocsomor
Copy link
Contributor

Description of the problem / feature request:

Replace this line with your answer.

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

Replace this line with your answer.

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

Follow the Android Tutorial on bazel.build until "Run the App": https://docs.bazel.build/versions/master/tutorial/android-app.html#run-the-app

If you have Python3 on the PATH, it will fail like so:

C:\src\bazel-examples\android\tutorial>bazel mobile-install //src/main:app
INFO: Reading 'startup' options from c:\users\laszlocsomor\.bazelrc: --output_user_root=c:/_bazel
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=95
INFO: Options provided by the client:
  Inherited 'build' options: --python_path=c:/Python37/python.exe
INFO: Reading rc options for 'mobile-install' from c:\users\laszlocsomor\.bazelrc:
  Inherited 'build' options: --verbose_failures --announce_rc
INFO: Analysed target //src/main:app (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: C:/src/bazel-examples/android/tutorial/src/main/BUILD:1:1: Injecting mobile install stub application failed (Exit 1): stubify_manifest.exe failed: error executing command
  cd C:/_bazel/t5swfuxe/execroot/__main__
bazel-out/host/bin/external/bazel_tools/tools/android/stubify_manifest.exe --mode=mobile_install --input_manifest bazel-out/x64_windows-fastbuild/bin/src/main/_merged/app/AndroidManifest.xml --output_manifest bazel-out/x64_windows-fastbuild/bin/src/main/app_files/mobile_install/AndroidManifest.xml --output_datafile bazel-out/x64_windows-fastbuild/bin/src/main/app_files/stub_application_data/stub_application_data.txt
Execution platform: @bazel_tools//platforms:host_platform
Traceback (most recent call last):
  File "\\?\c:\tmp\Bazel.runfiles_j8q3jcn7\runfiles\bazel_tools\tools\android\stubify_manifest.py", line 167, in <module>
    main()
  File "\\?\c:\tmp\Bazel.runfiles_j8q3jcn7\runfiles\bazel_tools\tools\android\stubify_manifest.py", line 154, in main
    output_file.write("\n".join([old_application, app_package]))
TypeError: a bytes-like object is required, not 'str'
Target //src/main:app failed to build
INFO: Elapsed time: 2.607s, Critical Path: 1.37s
INFO: 7 processes: 5 local, 2 worker.
FAILED: Build did NOT complete successfully

It works with Python2.

What operating system are you running Bazel on?

Windows 10

What's the output of bazel info release?

release 0.23.0

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

$ git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
git@github.com:bazelbuild/examples.git
b76d50e6719fe76cc6190d73aabb88822b71c4a5
b76d50e6719fe76cc6190d73aabb88822b71c4a5
@laszlocsomor
Copy link
Contributor Author

Similar error in incremental_install.py:

  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 839, in <module>
    main()
  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 828, in main
    extra_adb_args=FLAGS.extra_adb_arg)
  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 756, in IncrementalInstall
    UploadDexes(adb, execroot, app_dir, temp_dir, dexmanifest, bool(apk))
  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 367, in UploadDexes
    adb.Mkdir(dex_dir)
  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 288, in Mkdir
    self._Shell("mkdir -p %s" % d)
  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 312, in _Shell
    return self._Exec(["shell", cmd])
  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 182, in _Exec
    elif MultipleDevicesError.CheckError(stderr):
  File "\\?\c:\tmp\Bazel.runfiles_fbx84su6\runfiles\bazel_tools\tools\android\incremental_install.py", line 102, in CheckError
    return re.search("more than one (device and emulator|device|emulator)", s)
  File "c:\Python37\lib\re.py", line 183, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object
Target //src/main:app failed to build
INFO: Elapsed time: 6.184s, Critical Path: 5.19s
INFO: 1 process: 1 local.
FAILED: Build did NOT complete successfully

@laszlocsomor laszlocsomor self-assigned this Feb 28, 2019
@laszlocsomor laszlocsomor added type: bug P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Feb 28, 2019
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Android Issues for Android team type: bug
Projects
None yet
Development

No branches or pull requests

1 participant