Skip to content

Update Android Components version#4164

Merged
jonalmeida merged 1 commit intomozilla-mobile:masterfrom
MickeyMoz:ac-update
Mar 5, 2026
Merged

Update Android Components version#4164
jonalmeida merged 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

@MickeyMoz MickeyMoz force-pushed the ac-update branch 2 times, most recently from 93e8809 to e29fa32 Compare March 4, 2026 04:03
@Mugurell
Copy link
Contributor

Mugurell commented Mar 4, 2026

Upon further investigation it seems like this happens in the scenario of using AGP 9 to build and having the Nightly flavor recently configured to specifically configure the Nightly flavour to enable unit tests - this having been done to avoid a specific AGP 9 issue - reference-browser/issues/4028.

Created bug 2020921 to remove the new testFixtures package.

@MickeyMoz MickeyMoz force-pushed the ac-update branch 5 times, most recently from dace92c to d3ba908 Compare March 5, 2026 10:05
@rvandermeulen
Copy link
Contributor

@Mugurell Thanks, looks like your fix worked!

Copy link

@mergify mergify bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MickeyMoz 💪

@mergify mergify bot added the queued label Mar 5, 2026
@jonalmeida jonalmeida merged commit c7cdad5 into mozilla-mobile:master Mar 5, 2026
14 of 15 checks passed
@mergify
Copy link

mergify bot commented Mar 5, 2026

Merge Queue Status

Rule: default


  • Entered queue2026-03-05 16:34 UTC
  • Checks passed · in-place
  • Merged2026-03-05 16:34 UTC · at 65e89ee053e90703bf584a492e25b44599808901

This pull request spent 8 seconds in the queue, with no time running CI.

Required conditions to merge
  • status-success=pr-complete

@mergify mergify bot removed the queued label Mar 5, 2026
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.

4 participants