Skip to content

Update Android Components version#4164

Open
MickeyMoz wants to merge 1 commit intomozilla-mobile:masterfrom
MickeyMoz:ac-update
Open

Update Android Components version#4164
MickeyMoz wants to merge 1 commit intomozilla-mobile:masterfrom
MickeyMoz:ac-update

Conversation

@MickeyMoz
Copy link
Contributor

No description provided.

@rvandermeulen
Copy link
Contributor

@Mugurell This bustage looks like fallout from https://hg-edge.mozilla.org/mozilla-central/rev/8e6e8934164a7c9202e4b8929f6eff49b2114973.

Here's what Claude has to say about it:

Root Cause

The commit 8e6e8934164a7c9202e4b8929f6eff49b2114973 added testFixturesImplementation libs.robolectric to support-utils/build.gradle in AC, to support the new DefaultBrowserUtils.kt test fixture helper.

The bug: AGP incorrectly published this testFixturesImplementation dependency into the main artifact's Maven POM with scope=runtime. You can see this clearly by diffing the POMs:

  • support-utils-150.0.20260302211416.pom (last good build): no Robolectric
  • support-utils-150.0.20260303095635.pom (first bad build): Robolectric 4.16 listed as <scope>runtime</scope>

Because it's published as a runtime scope dependency in the main POM, Gradle pulls Robolectric (and its full dependency tree) into reference-browser's runtimeClasspath for any variant that consumes support-utils with minification enabled. R8 then processes those JARs and discovers that RobolectricTestRunner$DeprecatedTestRunnerDefaultConfigProvider (and 16 other places) reference com.google.auto.service.AutoService, which is an annotation-processor-only artifact that isn't in the classpath.

Is the dontwarn fix correct?

Yes, as a workaround, but with an important nuance:

-dontwarn com.google.auto.service.AutoService is safe because @AutoService is an annotation processor annotation — its only job is to generate META-INF/services/ files at compile time. Those files are already baked into the Robolectric JARs. The annotation class itself isn't needed at runtime. With the dontwarn in place, R8 suppresses the error and then tree-shakes away all of Robolectric (since no actual app code calls into it), so Robolectric doesn't end up in the final APK.

What the real fix looks like

The fix belongs upstream in AC. The testFixturesImplementation configuration should not bleed into the published <scope>runtime</scope> of the main artifact's POM — it should either be scoped to a separate -test-fixtures artifact or excluded from Maven publication entirely. This is a known AGP behavior where test fixtures dependencies can leak into the main variant's published POM when testFixtures publishing isn't carefully configured.

Recommendation

The dontwarn rule is the right call for reference-browser right now, but it should have a comment explaining why it exists and tracking the upstream issue. Something like:

# Robolectric is incorrectly published as a runtime dependency in support-utils
# (testFixturesImplementation leaking into the main POM) since AC 150.0.20260303095635.
# AutoService is annotation-processor-only and not needed at runtime; R8 tree-shakes
# all Robolectric code from the APK. Remove once AC fixes the publication bug.
# See: https://hg-edge.mozilla.org/mozilla-central/rev/8e6e8934164a7c9202e4b8929f6eff49b2114973
-dontwarn com.google.auto.service.AutoService

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