-
Notifications
You must be signed in to change notification settings - Fork 48
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
Conflicting version of R8/D8 in Dexer/Desugar classpath #300
Comments
fyi @ahumesky |
I agree with the reporter here, we certainly have some issues with duplicated versions of R8 and that can easily cause these issues. Unsure why it is non deterministic.
If I look at the R8 version bundled in that jar it does not match with the stack trace:
I don't think this version have the fixes Ian did for synthetics, but the stack trace also says differently:
|
You can validate what version of R8 was used to build the shards by running:
|
I managed to repro this as well. I just checked the version of the jar using your method and it does match the version ( |
I've finally got a chance to look at this yesterday. My original assumptions were completely wrong. I've seen the classpath issue happen with gradle builds so I assumed this was the same issue. In reality, the issue here is that the workers cache for dexbuilder completely ignores the synthetic context info, so if an entry is cached it will be used the cached dex content but will be archived without the synthetic info. I've added a fix for that here bazelbuild/bazel#20411 |
Ah, tricky! Thanks for looking into this |
Description of the bug:
We started seeing the following errors during dex merging when using D8
I did some investigation and the
META-INF/synthetic-contexts.map
in the.jar.dex.zip
is incomplete. It looks under some circumstances an older version of D8 is being used during dexing. The version of R8 being used, is an older version which does not output information about synthetic classes and their contexts. The version that should be used should be the one pointed by android_gmaven_r8, but instead is the one bundled by the@maven_android//:com_android_tools_build_builder_file
dep which was added as dependency in this commit bazelbuild/bazel@aaf94c6#diff-bdb5a620f62ba1e7228456cde29d508737679c9196143db3641b22bb3ca2fd2aR128. Ifcom_android_tools_build_builde
happens to appear before than the R8 version coming fromandroid_gmave_r8
dep in the dexer classpath, then dexmerging is likely to fail due to missing synthetic classes info.The r8 target shipped with the android tools depends on the gradle builder jar via
//src/tools/android/java/com/google/devtools/build/android:all_android_tools
which in turn transitively depends on the gradle jar. The gradle dependency needs to be teased out in order to avoid causing classpath conflicts.The version used seems to be non-deterministic and depends on which commit we are building our app . Furthermore we've only encountered this bug in our linux builds and we have not been able to repro on Mac builds.
Which category does this issue belong to?
Android
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
This bug is not deterministic and we are only able to repro at specific commits when building our app, but its easy to check the bundled version of R8 in the gradle jar. Furthermore we've only encountered this bug in our linux builds and we have not been able to repro on Mac builds.
Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?release 7.0.2.13 (internal release)
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.Built from internal forked version of bazel. Forked at this commit from upstream bazelbuild/bazel@252d363
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
bazelbuild/bazel@aaf94c6
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: