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

Can't build example basicapp #222

Open
pswaminathan opened this issue Mar 30, 2024 · 4 comments
Open

Can't build example basicapp #222

pswaminathan opened this issue Mar 30, 2024 · 4 comments

Comments

@pswaminathan
Copy link

Steps:

  1. Check out HEAD
  2. Go to examples/basicapp
  3. bazel build java/com/basicapp:basic_app

Output:

bazel build java/com/basicapp:basic_app
ERROR: /private/var/tmp/_bazel_p/55ff8364e78f780939b7116c861984c8/external/rules_android~/tools/android/BUILD:173:10: in sh_binary rule @@rules_android~//tools/android:desugar_java8: target '@@bazel_tools//src/tools/android/java/com/google/devtools/build/android/r8:desugar' is not visible from target '@@rules_android~//tools/android:desugar_java8'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: /private/var/tmp/_bazel_p/55ff8364e78f780939b7116c861984c8/external/rules_android~/tools/android/BUILD:173:10: Analysis of target '@@rules_android~//tools/android:desugar_java8' failed
ERROR: Analysis of target '//java/com/basicapp:basic_app' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.142s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
@pswaminathan pswaminathan changed the title Can't build example Can't build example basicapp Mar 30, 2024
@ted-xie
Copy link
Contributor

ted-xie commented Apr 10, 2024

IIRC I fixed this upstream in bazelbuild/bazel a while ago, but it hasn't made it into a release yet. If you use a build of bazel close to head (as our README suggests), this should build correctly.

@pswaminathan
Copy link
Author

Thanks @ted-xie ! That does indeed get me farther, but still a failure:

bazel build --verbose_failures java/com/basicapp:basic_app
Starting local Bazel server and connecting to it...
INFO: Analyzed target //java/com/basicapp:basic_app (330 packages loaded, 16043 targets configured).
ERROR: /Users/p/Code/bazel/rules_android/examples/basicapp/java/com/basicapp/BUILD:9:16: Compiling Android Resources in java/com/basicapp/_migrated/basic_lib_symbols/symbols.zip failed: (Exit 2): java failed: error executing CompileAndroidResources command (from target //java/com/basicapp:basic_lib)
  (cd /private/var/tmp/_bazel_p/55ff8364e78f780939b7116c861984c8/sandbox/darwin-sandbox/1/execroot/_main && \
  exec env - \
  external/rules_java~~toolchains~remotejdk11_macos_aarch64/bin/java -Xms4G -Xmx4G -XX:+ExitOnOutOfMemoryError -jar bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox_deploy.jar --tool COMPILE_LIBRARY_RESOURCES -- --aapt2 bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_android~~android_sdk_repository_extension~androidsdk/aapt2_binary --resources java/com/basicapp/res:::: --output bazel-out/darwin_arm64-fastbuild-android-ST-80dd4ae33d52/bin/java/com/basicapp/_migrated/basic_lib_symbols/symbols.zip --targetLabel //java/com/basicapp:basic_lib --manifest bazel-out/darwin_arm64-fastbuild-android-ST-80dd4ae33d52/bin/java/com/basicapp/_migrated/_min_sdk_bumped/basic_lib/AndroidManifest.xml --androidJar external/rules_android~~android_sdk_repository_extension~androidsdk/platforms/android-34/android.jar)
# Configuration: e0ee379e8deebddd77b721799537f6bcb4ec2a7c5aeb6e253cef82be0b0f4583
# Execution platform: @@platforms//host:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Error parsing command line: Unrecognized option: --targetLabel
Try --help.
Target //java/com/basicapp:basic_app failed to build
INFO: Elapsed time: 5.983s, Critical Path: 0.42s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully

@ahumesky
Copy link
Collaborator

I wasn't able to repro this -- the error is pretty surprising: Error parsing command line: Unrecognized option: --targetLabel. This is the code that creates that COMPILE_LIBRARY_RESOURCES action:

args.add("--tool", "COMPILE_LIBRARY_RESOURCES")

and --targetLabel is not added there, and it doesn't look like it was there before. Are you using some local customizations?

@pswaminathan
Copy link
Author

pswaminathan commented Apr 26, 2024

Whoops, turns out I do have some local customizations that I had forgotten about. I'll revert back to main and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants