Skip to content

fix: Remove BaseExtension usage for AGP 9 compatibility#1212

Merged
runningcode merged 3 commits into
mainfrom
no/agp-9-compat
May 21, 2026
Merged

fix: Remove BaseExtension usage for AGP 9 compatibility#1212
runningcode merged 3 commits into
mainfrom
no/agp-9-compat

Conversation

@runningcode

@runningcode runningcode commented May 21, 2026

Copy link
Copy Markdown
Contributor

BaseExtension isn't deprecated when compiling against AGP 8.X but it is suddenly removed in AGP 9.X :(
See docs: https://developer.android.com/build/releases/agp-9-0-0-release-notes

This removes all usages of it.

Separately because of a subtle bug that seer pointed out, I decided that we don't support AGP 7.X with snapshots. In that case we'll throw a clear error message when snapshots are enabled. #1212 (comment)

Replace `BaseExtension` (removed in AGP 9) with stable APIs that
work across all supported AGP versions (7.4+):

- Use `ApplicationVariant.namespace` instead of `BaseExtension.namespace`
- Use `CommonExtension` instead of `BaseExtension` for telemetry
- Use `CommonExtension.defaultConfig.minSdk` instead of the deprecated
  `minSdkVersion.apiLevel`

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
runningcode and others added 2 commits May 21, 2026 15:21
The `variant.namespace` provider may be absent on AGP 7.x, causing a
`MissingValueException` at task execution time. AGP 8.0 made namespace
mandatory, so add a clear check at configuration time.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@0xadam-brown 0xadam-brown 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.

Thx for the quick fix 🥇

sentryProject: String?,
) {
check(AgpVersions.CURRENT >= AgpVersions.VERSION_8_0_0) {
"Sentry Snapshots require Android Gradle Plugin 8.0 or higher. " +

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.

👍

Comment thread CHANGELOG.md
### Fixes

- Fail fast with a clear error when Snapshots feature is used with AGP 7.x ([#1212](https://github.com/getsentry/sentry-android-gradle-plugin/pull/1212))

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.

l: Do we need to make this limitation explicit in any of our developer docs? (Not a blocker here, of course.)

@0xadam-brown

Copy link
Copy Markdown
Member

(Test Matrix failure is the same existing issue mentioned here. Doesn't need to hold us up.)

@runningcode
runningcode merged commit 711fb04 into main May 21, 2026
25 of 26 checks passed
@runningcode
runningcode deleted the no/agp-9-compat branch May 21, 2026 14:48
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