Skip to content

Failing to run d8_dexbuilder with buildtools 31 #13989

@Kernald

Description

@Kernald

Description of the problem / feature request:

Using buildtools 31, Bazel can't build dex files anymore. With d8 disabled (default):

ERROR: /private/var/tmp/_bazel_kernald/dc8fa02be43b6315d36f6bf2bf056429/external/androidsdk/BUILD.bazel:13:25: Extracting interface @androidsdk//:dx_jar_import failed: missing input file 'external/androidsdk/build-tools/31.0.0/lib/dx.jar', owner: '@androidsdk//:build-tools/31.0.0/lib/dx.jar'
ERROR: /private/var/tmp/_bazel_kernald/dc8fa02be43b6315d36f6bf2bf056429/external/androidsdk/BUILD.bazel:13:25 Extracting interface @androidsdk//:dx_jar_import failed: 1 input file(s) do not exist

With d8 enabled with the following flags:

# Enable d8 merger
build --define=android_dexmerger_tool=d8_dexmerger

# Flags for the d8 dexer
build --define=android_incremental_dexing_tool=d8_dexbuilder
build --define=android_standalone_dexing_tool=d8_compat_dx
build --nouse_workers_with_dexbuilder
ERROR: /private/var/tmp/_bazel_kernald/dc8fa02be43b6315d36f6bf2bf056429/external/maven/BUILD:4748:11: Dexing external/maven/_dx/androidx_transition_transition/classes_and_libs_merged.jar_desugared.jar with applicable dexopts [] failed: (Exit 1): d8_dexbuilder failed: error executing command bazel-out/darwin-py2-opt-exec-2B5CBBC6/bin/external/bazel_tools/tools/android/d8_dexbuilder ... (remaining 1 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Error: Could not find or load main class com.android.tools.r8.compatdexbuilder.CompatDexBuilder
Caused by: java.lang.ClassNotFoundException: com.android.tools.r8.compatdexbuilder.CompatDexBuilder

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

In a WORKSPACE:

android_sdk_repository(
    name = "androidsdk",
    api_level = 31,
    build_tools_version = "31.0.0",
)

(I don't think the api_level actually matters here.)

Try to build anything that requires dexing.

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

release 4.2.1

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)team-AndroidIssues for Android teamtype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions