question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build failure with bazel, can't find `build-tools/33.0.0-rc4/lib/dx.jar`

See original GitHub issue

I’m trying to run bazel build testdpc but it fails.

First it wants SDK 33, AFAICT we only have Tiramisu publicly so far. I worked around that by symlinking Tiramisu to 33 in my SDK install.

After that, it fails with:

INFO: Analyzed target //:testdpc (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/user/.cache/bazel/_bazel_user/1453d0cfa808044da9e372be74772bd0/external/androidsdk/BUILD.bazel:13:25: Extracting interface @androidsdk//:dx_jar_import failed: missing input file 'external/androidsdk/build-tools/33.0.0-rc4/lib/dx.jar', owner: '@androidsdk//:build-tools/33.0.0-rc4/lib/dx.jar'
ERROR: /home/user/.cache/bazel/_bazel_user/1453d0cfa808044da9e372be74772bd0/external/androidsdk/BUILD.bazel:13:25: Extracting interface @androidsdk//:dx_jar_import failed: 1 input file(s) do not exist
Target //:testdpc failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/user/.cache/bazel/_bazel_user/1453d0cfa808044da9e372be74772bd0/external/androidsdk/BUILD.bazel:13:25 Extracting interface @androidsdk//:dx_jar_import failed: 1 input file(s) do not exist
INFO: Elapsed time: 0.412s, Critical Path: 0.32s
INFO: 74 processes: 41 internal, 33 linux-sandbox.
FAILED: Build did NOT complete successfully

If I check the folder, it has a d8.jar but not dx.jar

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
jindogcommented, May 26, 2022

Check the command to build "This sample uses the Bazel build system. To build this project, use the “bazel build –noincremental_dexing

IF you still have an issue on build …

I had the same issue on my desktops, and recognized it might be an issue on Bazel build itself. Here’re the solutions which I googled

  1. Just copy the dx.jar from old build tool directory to 33 directory

OR

  1. Use additional command line param to use d8 instead of dx

$ bazel build testdpc --define=android_dexmerger_tool=d8_dexmerger --define=android_incremental_dexing_tool=d8_dexbuilder --nouse_workers_with_dexbuilder


I’m not fully confident with this change, but got a successful build after adding this line on BUILD file (the number of ‘dex_shard’ was needed to be increased)

android_binary(
    name = "testdpc",
    custom_package = PACKAGE,
    dexopts = [
        "--force-jumbo",
    ],
    manifest = MANIFEST,
    dex_shards = 2,
    multidex = "native",
    deps = [
        ":testdpc_lib",
    ],
)

$ bazel build testdpc --define=android_dexmerger_tool=d8_dexmerger --define=android_incremental_dexing_tool=d8_dexbuilder --nouse_workers_with_dexbuilder

INFO: Analyzed target //:testdpc (1 packages loaded, 277 targets configured). INFO: Found 1 target… Target //:testdpc up-to-date: bazel-bin/testdpc_deploy.jar bazel-bin/testdpc_unsigned.apk bazel-bin/testdpc.apk INFO: Elapsed time: 7.756s, Critical Path: 7.50s INFO: 13 processes: 4 internal, 8 linux-sandbox, 1 worker. INFO: Build completed successfully, 13 total actions

2reactions
jscott1989commented, May 26, 2022

Thanks for resolving that! Let’s leave this issue open in case other people have this issue - and we’ll try to figure out the proper solution which doesn’t involve copying files around.

I’m new to using Bazel so don’t know the best practices - we’re using it to make the build system as consistent as possible with the one used internally for TestDPC development.

Re: the version code not being set - we’ll have a fix for that soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiling Bazel from Source
See Installing Bazel. (Or you can build from scratch (bootstrap).) Troubleshooting: If you cannot run Bazel by typing bazel in a terminal:.
Read more >
Gerrit build with bazel: maven2 jar sh1 not match
My build environment is Ubuntu 14.04.6, Python v3.4.3, java 8, nodejs v8.9.3, apache/2.4.7, Maven 3.0.5 I use "bazel build ...
Read more >
Error building ONOS master with bazel - Google Groups
Cannot change ownership to uid 501, gid 50: Invalid argument ... Use --verbose_failures to see the command lines of failed build steps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found