Skip to content

Commit 842b197

Browse files
runningcodeclaude
andauthored
build(android): Bump AGP to 9.5.1 (#6540)
Raise the default Android Gradle Plugin from 9.4.0 to 9.5.1, the latest stable release. The AGP matrix moves to 9.0.0/9.4.0/9.5.1, keeping the minimum supported version and the previous default, and the replay snapshot upload follows the new default. Lint 9.5 can't load the custom checks bundled with older androidx.lifecycle releases and reports ObsoleteLintCustomCheck, which warningsAsErrors fails on. Disable it in the affected modules; the skipped checks cover lifecycle APIs those modules don't call. Lint 9.5's new ThreadConstraint check flags ScreenshotUtils.takeScreenshot, which is safe to call from any thread because captureScreenshot posts the view draw to the UI thread. Suppress it there. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3d33765 commit 842b197

8 files changed

Lines changed: 27 additions & 4 deletions

File tree

‎.github/workflows/agp-matrix.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
agp: [ '9.0.0', '9.2.1', '9.4.0' ]
20+
agp: [ '9.0.0', '9.4.0', '9.5.1' ]
2121
integrations: [ true, false ]
2222

2323
name: AGP Matrix Release - AGP ${{ matrix.agp }} - Integrations ${{ matrix.integrations }}
2424
env:
2525
VERSION_AGP: ${{ matrix.agp }}
2626
APPLY_SENTRY_INTEGRATIONS: ${{ matrix.integrations }}
2727
# Upload replay snapshots from one cell only. Forks don't have access to the upload secret.
28-
UPLOAD_REPLAY_SNAPSHOTS: ${{ matrix.agp == '9.4.0' && matrix.integrations && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
28+
UPLOAD_REPLAY_SNAPSHOTS: ${{ matrix.agp == '9.5.1' && matrix.integrations && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
2929

3030
steps:
3131
- name: Checkout Repo

‎gradle/libs.versions.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ room2 = "2.8.5"
4141
room3 = "3.0.0-rc01"
4242
sagp = "6.13.0"
4343
# The AGP matrix job overrides this with the VERSION_AGP env var, through each build's settings.
44-
agp = "9.4.0"
44+
agp = "9.5.1"
4545
sqlite = "2.6.2"
4646
sqliteRc = "2.8.0-alpha03" # Required by Room3 3.0.0-rc*
4747
slf4j = "1.7.30"

‎sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotUtils.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public final class ScreenshotUtils {
3838
}
3939

4040
// Used by Hybrid SDKs
41-
@SuppressLint("NewApi")
41+
// Lint infers a UI-thread constraint from the View calls in captureScreenshot, which clashes with
42+
// Bitmap.compress's @WorkerThread. captureScreenshot is safe from any thread, as it posts the
43+
// view draw to the UI thread when it isn't already on it.
44+
@SuppressLint({"NewApi", "ThreadConstraint"})
4245
public static @Nullable byte[] takeScreenshot(
4346
final @NotNull Activity activity,
4447
final @NotNull IThreadChecker threadChecker,

‎sentry-android-fragment/build.gradle.kts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ android {
5454

5555
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
5656
checkReleaseBuilds = false
57+
58+
// Lint 9.5 can't load the custom checks bundled with older androidx.lifecycle releases and
59+
// reports that it skips them. They only cover lifecycle APIs this module doesn't call.
60+
disable += "ObsoleteLintCustomCheck"
5761
}
5862

5963
buildFeatures { buildConfig = true }

‎sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ android {
7777
// This module is the one lint picks to check the build root's Gradle wrapper, and this check
7878
// compares it with the latest Gradle release online, so every new release would fail the build.
7979
disable += "AndroidGradlePluginVersion"
80+
81+
// Lint 9.5 can't load the custom checks bundled with older androidx.lifecycle releases and
82+
// reports that it skips them. They only cover lifecycle APIs this module doesn't call.
83+
disable += "ObsoleteLintCustomCheck"
8084
}
8185

8286
androidComponents.beforeVariants {

‎sentry-android-navigation/build.gradle.kts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ android {
5454

5555
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
5656
checkReleaseBuilds = false
57+
58+
// Lint 9.5 can't load the custom checks bundled with older androidx.lifecycle releases and
59+
// reports that it skips them. They only cover lifecycle APIs this module doesn't call.
60+
disable += "ObsoleteLintCustomCheck"
5761
}
5862

5963
buildFeatures { buildConfig = true }

‎sentry-android-replay/build.gradle.kts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ android {
6262

6363
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
6464
checkReleaseBuilds = false
65+
66+
// Lint 9.5 can't load the custom checks bundled with older androidx.lifecycle releases and
67+
// reports that it skips them. They only cover lifecycle APIs this module doesn't call.
68+
disable += "ObsoleteLintCustomCheck"
6569
}
6670

6771
buildFeatures { buildConfig = true }

‎sentry-compose/build.gradle.kts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ android {
116116

117117
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
118118
checkReleaseBuilds = false
119+
120+
// Lint 9.5 can't load the custom checks bundled with older androidx.lifecycle releases and
121+
// reports that it skips them. They only cover lifecycle APIs this module doesn't call.
122+
disable += "ObsoleteLintCustomCheck"
119123
}
120124

121125
buildFeatures { buildConfig = true }

0 commit comments

Comments
 (0)