Skip to content

build: Bump AGP to 9.2.1 and migrate Android modules#5779

Merged
runningcode merged 1 commit into
mainfrom
no/java-649-bump-agp-920
Jul 21, 2026
Merged

build: Bump AGP to 9.2.1 and migrate Android modules#5779
runningcode merged 1 commit into
mainfrom
no/java-649-bump-agp-920

Conversation

@runningcode

@runningcode runningcode commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

We need to bump AGP to 9.2 because compile SDK introduced a breaking change (37.0 vs 37) which makes it very difficult to compile using AGP 8.X.

AGP 9.X introduced several breaking changes that we try to mitigate in this PR.

  • AGP 9.X sets the java target compile level to 11 from 8, so we override this to keep the same level.
  • AGP 9.X includes a bundles kotlin plugin, we disable this with android.builtInKotlin=false
  • AGP 9.X has a new DSL which we disable with android.builtInKotlin=false
  • AGP 9.X disables unit tests for debug variants. we therefore set the test variant to release in modules where debug is disabled.
  • Fix and ignore some AGP 9.X lint warnings

Fixes #5777
Linear: #5777 (#5777)

#skip-changelog

🤖 Generated with Claude Code

https://claude.ai/code/session_01EmE8hdaj9H9K61opK2PZ6U

@linear-code

linear-code Bot commented Jul 16, 2026

Copy link
Copy Markdown

JAVA-649

Comment thread sentry-compose/build.gradle.kts
@sentry

sentry Bot commented Jul 16, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.49.0 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode
runningcode force-pushed the no/java-649-bump-agp-920 branch 2 times, most recently from eaea270 to aed7d88 Compare July 17, 2026 08:30
Comment thread build.gradle.kts
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 317.10 ms 376.82 ms 59.72 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b193867 331.08 ms 397.06 ms 65.98 ms
3d205d0 352.15 ms 432.53 ms 80.38 ms
22ff2c7 306.60 ms 336.65 ms 30.05 ms
a5ab36f 320.47 ms 389.77 ms 69.30 ms
539ca63 313.51 ms 355.43 ms 41.92 ms
dba088c 365.46 ms 366.31 ms 0.85 ms
4e3e79d 312.02 ms 376.24 ms 64.22 ms
7314dbe 437.83 ms 505.64 ms 67.81 ms
ad8da22 314.38 ms 352.29 ms 37.91 ms
bb0ff41 344.70 ms 413.82 ms 69.12 ms

App size

Revision Plain With Sentry Diff
b193867 1.58 MiB 2.19 MiB 620.00 KiB
3d205d0 1.58 MiB 2.10 MiB 532.97 KiB
22ff2c7 0 B 0 B 0 B
a5ab36f 1.58 MiB 2.12 MiB 555.26 KiB
539ca63 1.58 MiB 2.12 MiB 551.41 KiB
dba088c 1.58 MiB 2.13 MiB 558.99 KiB
4e3e79d 0 B 0 B 0 B
7314dbe 1.58 MiB 2.10 MiB 533.45 KiB
ad8da22 1.58 MiB 2.29 MiB 719.83 KiB
bb0ff41 0 B 0 B 0 B

Previous results on branch: no/java-649-bump-agp-920

Startup times

Revision Plain With Sentry Diff
f04abfe 294.39 ms 358.80 ms 64.41 ms
876c0ef 344.42 ms 435.33 ms 90.90 ms

App size

Revision Plain With Sentry Diff
f04abfe 0 B 0 B 0 B
876c0ef 0 B 0 B 0 B

@runningcode
runningcode force-pushed the no/java-649-bump-agp-920 branch 2 times, most recently from 7a60384 to 7d0c248 Compare July 17, 2026 11:13

@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 7d0c248. Configure here.

Comment thread sentry-android-core/build.gradle.kts
Raise the minimum AGP to 9.0.0 (default fallback 9.2.1) and perform the
AGP 9 migration: refresh the AGP-compat matrix (9.0.0/9.1.1/9.2.1), add
the AGP 9 opt-outs (android.builtInKotlin/newDsl, lint 9.2.1), pin Java
and Kotlin targets to 8 across the Android library modules, set
testBuildType to release for unit tests (including sentry-compose), bump
the uitest modules to JVM 11, and resolve the AGP 9.2 lint findings.

Robolectric 4.15 caps at API 35, so pin the affected tests with
@config(sdk = [35]) to keep them green against targetSdk 36. lint 9.2.1
flags compileSdk 36 as outdated (37 is available); disable GradleDependency
for the Android modules since the SDK bump lives in the API 37 PR.

Split out from the API 37 bump (#5768) so the toolchain upgrade lands on
its own. compileSdk/targetSdk stay at 36 here.

Co-authored-by: Adam Brown <adam.brown@sentry.io>

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EmE8hdaj9H9K61opK2PZ6U
@runningcode
runningcode force-pushed the no/java-649-bump-agp-920 branch from 7d0c248 to fb2e3e2 Compare July 17, 2026 11:24
Comment thread .github/workflows/agp-matrix.yml
Comment thread build.gradle.kts
Comment thread sentry-apache-http-client-5/build.gradle.kts
@runningcode

Copy link
Copy Markdown
Contributor Author

I'm guessing the failing snapshot test diff is due to a bump in layoutlib which mustve changed the default theme from dark to light: https://github.com/getsentry/sentry-java/pull/5779/checks?check_run_id=87875970201

I went ahead and approved it. I don't think it is worth investigating

Comment thread build.gradle.kts

@romtsn romtsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

one question and one comment, but unblocking ✅

@runningcode
runningcode merged commit 0e94865 into main Jul 21, 2026
71 checks passed
@runningcode
runningcode deleted the no/java-649-bump-agp-920 branch July 21, 2026 11:56
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.

Bump AGP to 9.2.0 in sentry-java

2 participants