Skip to content

fix(proguard): Unwrap analytics variant for optimization - #1382

Merged
romtsn merged 24 commits into
mainfrom
fix/agp-analytics-optimization
Aug 11, 2026
Merged

romtsn merged 24 commits into
mainfrom
fix/agp-analytics-optimization

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • unwrap AGP's analytics variant before reading the internal optimization creation config
  • force AGP analytics wrappers in TestKit with android.enableProfileJson=true
  • fail the optimization integration test if the analytics unwrap warning appears
  • shared unwrapImpl() also covers isDebuggable, assembleProvider, and installProvider

AGP 9.3 can wrap the public variant in AnalyticsEnabledApplicationVariant. The wrapper does not expose getOptimizationCreationConfig, so mapping tasks were skipped when only optimization.enable enabled R8.

This is a bug in the 6.18.0 AGP 9.3 support path, not missing AGP 9.3.1 support.

Mutation proof

Without the unwrap, AGP 9.3+ TestKit failed with the same customer stack when analytics wrappers were forced via android.enableProfileJson=true:

AnalyticsEnabledApplicationVariant_Decorated.getOptimizationCreationConfig()

Earlier sample-path mutation (before switching coverage to TestKit):

The unwrap is restored on top of the forced-analytics TestKit coverage.

Testing

  • git diff --check
  • TestKit mutation CI proved the AGP 9.3+ analytics path fails without the unwrap
  • local Gradle checks are unavailable because this sandbox has no JDK
  • waiting on restored-fix CI for green proof

Requested by Roman Zavarnitsyn.

--

View Junior Session [Sentry]

sentry-junior Bot and others added 8 commits August 11, 2026 09:49
Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
@romtsn
romtsn marked this pull request as ready for review August 11, 2026 11:32
@romtsn romtsn added the sanity-check PR needs a lightweight review for obvious issues label Aug 11, 2026

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the quick fix!

Comment thread gradle.properties Resolved
Comment thread examples/android-gradle/build.gradle Resolved
sentry-junior Bot and others added 2 commits August 11, 2026 13:22
Temporarily skip analytics unwrap so CI can prove the TestKit fixture
with enableProfileJson fails without the production fix.

Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
TestKit with enableProfileJson failed on AGP 9.3+ without unwrap, matching
the customer AnalyticsEnabledApplicationVariant path. Restore the fix.
Comment thread CHANGELOG.md Resolved
Comment thread CHANGELOG.md Resolved
Log when getDelegate unwrap fails so incomplete internal variant access
is visible, and assert assemble/install/debuggable behavior under the
forced-analytics TestKit fixture.

Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
Use withArguments per scenario so runner args do not accumulate, and
assert installRelease dry-run pulls in native-symbol upload via
installProvider wiring.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 444edbf. Configure here.

sentry-junior Bot and others added 4 commits August 11, 2026 20:51
AGP only registers install* for signing-ready variants. Point release
at the debug signingConfig so the analytics installProvider assertion
can run.
trimIndent left applyUploadNativeSymbols ending on `}` with no newline.
Appending android { glued to `}android {`, so Groovy treated it as
sentry.android and failed the new analytics installProvider TestKit test.
Drop the settings.gradle.kts blank-line hunk now that main has #1388.

Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
@romtsn
romtsn merged commit bceaebd into main Aug 11, 2026
24 checks passed
@romtsn
romtsn deleted the fix/agp-analytics-optimization branch August 11, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants