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

Replacing Compat Dx With Reference To Internal Bazel Build's Dx #15213

Closed

Conversation

EdbertChan
Copy link

@EdbertChan EdbertChan commented Apr 11, 2022

Initial Issue:
Bazel fails to build on build_tools_version 31.

Error: Could not find or load main class com.android.tools.r8.compatdx.CompatDx

ceb498f should have fixed the issue. However, I am not able to compile.

The error I get from --verbose_failures boils down to this line
bazel-out/k8-opt-exec-2B5CBBC6/bin/external/androidsdk/d8_compat_dx --dex '--num-threads=5' '--output=bazel-out/k8-fastbuild/bin/apps/presidio/helix/app-apk/_mobile_install/bin_debug/stub_application/classes.dex' bazel-out/k8-fastbuild/bin/apps/presidio/helix/app-apk/_mobile_install/bin_debug/stub_deploy.jar

When I look into the d8_compat_dx, I only see that a manifest file exists in it where it says it was created by "Target-Label: @androidsdk//:d8_compat_dx" and no other classes. Looking at this line in android_sdk_repository.bzl, it looks like Bazel is still trying to use the d8 packaged in build-tools in the Android SDK rather than trying to create its own.

See #13989 for the original discussion.

Fix:

Make the d8_compat_dx reference the internal Bazel built dx tools.

We tested this by running bazel mobile-install on all our apps.

@google-cla
Copy link

google-cla bot commented Apr 11, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@ahumesky
Copy link
Contributor

Ah thanks for the change here, but coincidentally as part of other improvements, we've made almost identical changes that should address this that we're pushing out likely today

@EdbertChan
Copy link
Author

@ahumesky Could you link the commit where this change took place in the main branch just for future reference in case other people encounter this?

@EdbertChan
Copy link
Author

Nevermind I see it here:
b93f828133e74cb3589ba7ffcfe74d2fe72430cd

Closing out

@EdbertChan EdbertChan closed this Apr 11, 2022
@ahumesky
Copy link
Contributor

@EdbertChan Here's the commit: b93f828

@ahumesky
Copy link
Contributor

Ah I see you already found it :)

@EdbertChan EdbertChan deleted the edbert_gh/compat_dx_fix branch April 12, 2022 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants