From 91a36c298bebe211bf3b812bc21ba5c8187a40c1 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 1 Jun 2026 16:22:50 +0200 Subject: [PATCH 1/7] ref(build): Consolidate sentry-java version into version catalog The sentry SDK version was declared twice: once in libs.versions.toml (7.0.0, used for the plugin's own compile dependency) and once in gradle.properties as sdk_version (8.43.0, used as BuildConfig.SdkVersion for auto-installation defaults and telemetry). Consolidate into a single source of truth in libs.versions.toml and read it via libs.versions.sentry in build.gradle.kts. Dependabot (gradle package ecosystem, directory "/") now handles updates to the sentry version via libs.versions.toml, making the custom getsentry/github-workflows/updater job and scripts/update-android.sh redundant. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/update-deps.yml | 9 --------- gradle/libs.versions.toml | 2 +- plugin-build/build.gradle.kts | 2 +- plugin-build/gradle.properties | 1 - scripts/update-android.sh | 29 ----------------------------- 5 files changed, 2 insertions(+), 41 deletions(-) delete mode 100755 scripts/update-android.sh diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index e1a37c881..afe18ee41 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -25,15 +25,6 @@ jobs: name: CLI ssh-key: ${{ secrets.CI_DEPLOY_KEY }} - android: - runs-on: ubuntu-latest - steps: - - uses: getsentry/github-workflows/updater@607fed74f812e69201531a5185b6c3c57caa4e89 # v3 - with: - path: scripts/update-android.sh - name: Android SDK - ssh-key: ${{ secrets.CI_DEPLOY_KEY }} - composable-preview-scanner: runs-on: ubuntu-latest steps: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b65dd7052..0ea6f65ce 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ agp = "8.10.1" asm = "9.4" # // compatibility matrix -> https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/instrumentation/InstrumentationContext#apiversion ktfmt = "0.51" sqlite = "2.1.0" -sentry = "7.0.0" +sentry = "8.43.0" sampleCoroutines = "1.5.2" sampleRoom = "2.7.2" diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index 842144260..e286c30c1 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -322,7 +322,7 @@ buildConfig { className("BuildConfig") buildConfigField("String", "Version", provider { "\"${project.version}\"" }) - buildConfigField("String", "SdkVersion", provider { "\"${project.property("sdk_version")}\"" }) + buildConfigField("String", "SdkVersion", libs.versions.sentry.map { "\"$it\"" }) buildConfigField("String", "AgpVersion", provider { "\"${BuildPluginsVersion.AGP}\"" }) buildConfigField("String", "CliVersion", propertyVersionProvider("sentry-cli.properties")) buildConfigField( diff --git a/plugin-build/gradle.properties b/plugin-build/gradle.properties index f5a0dafc7..5a088b400 100644 --- a/plugin-build/gradle.properties +++ b/plugin-build/gradle.properties @@ -8,7 +8,6 @@ org.gradle.parallel=true name = sentry-android-gradle-plugin group = io.sentry version = 6.9.0 -sdk_version = 8.43.0 # publication pom properties POM_NAME=Sentry Android Gradle Plugin diff --git a/scripts/update-android.sh b/scripts/update-android.sh deleted file mode 100755 index 4981f2fa7..000000000 --- a/scripts/update-android.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -cd $(dirname "$0")/../ -file='plugin-build/gradle.properties' -content=$(cat $file) - -regex='(sdk_version = *)([0-9\.]+)' -if ! [[ $content =~ $regex ]]; then - echo "Failed to find the Android SDK version in $file" - exit 1 -fi - -case $1 in -get-version) - echo ${BASH_REMATCH[2]} - ;; -get-repo) - echo "https://github.com/getsentry/sentry-java.git" - ;; -set-version) - newValue="${BASH_REMATCH[1]}$2" - echo "${content/${BASH_REMATCH[0]}/$newValue}" >$file - ;; -*) - echo "Unknown argument $1" - exit 1 - ;; -esac From 30df376c0f5a70d06d635c6c24d19ccc0d01ca12 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 1 Jun 2026 16:28:47 +0200 Subject: [PATCH 2/7] ref(build): Consolidate sentry-java version into version catalog The sentry SDK version was declared twice: once in libs.versions.toml (7.0.0, used for the plugin's own compile dependency) and once in gradle.properties as sdk_version (8.43.0, used as BuildConfig.SdkVersion for auto-installation defaults and telemetry). Consolidate into a single source of truth in libs.versions.toml and read it via libs.versions.sentry in build.gradle.kts. Update scripts/update-android.sh to read/write the version from libs.versions.toml instead of gradle.properties. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/update-deps.yml | 9 +++++++++ scripts/update-android.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 scripts/update-android.sh diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index afe18ee41..e1a37c881 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -25,6 +25,15 @@ jobs: name: CLI ssh-key: ${{ secrets.CI_DEPLOY_KEY }} + android: + runs-on: ubuntu-latest + steps: + - uses: getsentry/github-workflows/updater@607fed74f812e69201531a5185b6c3c57caa4e89 # v3 + with: + path: scripts/update-android.sh + name: Android SDK + ssh-key: ${{ secrets.CI_DEPLOY_KEY }} + composable-preview-scanner: runs-on: ubuntu-latest steps: diff --git a/scripts/update-android.sh b/scripts/update-android.sh new file mode 100755 index 000000000..95411e18c --- /dev/null +++ b/scripts/update-android.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd $(dirname "$0")/../ +file='gradle/libs.versions.toml' +content=$(cat $file) + +regex='(sentry = ")([0-9\.]+)' +if ! [[ $content =~ $regex ]]; then + echo "Failed to find the Android SDK version in $file" + exit 1 +fi + +case $1 in +get-version) + echo ${BASH_REMATCH[2]} + ;; +get-repo) + echo "https://github.com/getsentry/sentry-java.git" + ;; +set-version) + newValue="${BASH_REMATCH[1]}$2" + echo "${content/${BASH_REMATCH[0]}/$newValue}" >$file + ;; +*) + echo "Unknown argument $1" + exit 1 + ;; +esac From 7e7d84b5a2a76ad011b9faa6f7c716e13fe6b947 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 1 Jun 2026 16:37:54 +0200 Subject: [PATCH 3/7] fix(build): Replace removed sentry-android-okhttp with sentry-okhttp sentry-android-okhttp was removed in sentry-java 8.0.0 and replaced by sentry-okhttp, which is a plain java-library (JAR) rather than an AAR. Co-Authored-By: Claude Sonnet 4.6 --- gradle/libs.versions.toml | 1 - plugin-build/build.gradle.kts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0ea6f65ce..a89d29206 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,7 +51,6 @@ sqlite = { group = "androidx.sqlite", name = "sqlite", version.ref = "sqlite" } sqliteFramework = { group = "androidx.sqlite", name = "sqlite-framework", version.ref = "sqlite" } sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" } sentryAndroid = { group = "io.sentry", name = "sentry-android", version.ref = "sentry" } -sentryAndroidOkhttp = { group = "io.sentry", name = "sentry-android-okhttp", version.ref = "sentry" } sentryOkhttp = { group = "io.sentry", name = "sentry-okhttp", version.ref = "sentry" } sentrySpringBootJakarta = { group = "io.sentry", name = "sentry-spring-boot-starter-jakarta", version.ref = "sentry" } diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index e286c30c1..7f4170428 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -59,7 +59,7 @@ dependencies { testImplementationAar(libs.sqliteFramework) testRuntimeOnly(files(androidSdkPath)) testImplementationAar(libs.sentryAndroid) - testImplementationAar(libs.sentryAndroidOkhttp) + testImplementation(libs.sentryOkhttp) testImplementationAar(libs.sentryOkhttp) // Needed to read contents from APK/Source Bundles From b901140b6c23fc4206442491fd9250382348b28d Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 1 Jun 2026 17:05:15 +0200 Subject: [PATCH 4/7] fix(build): Fix update-android.sh regex to match full version string [0-9\.]+ stops at the first non-numeric character, so when the current version in libs.versions.toml has a prerelease suffix (e.g. 9.0.0-RC1), set-version only matches the numeric prefix and leaves the suffix in place, producing corrupt entries like sentry = "9.1.0-RC1". Switch to [^"]+ so the entire value up to the closing quote is captured and replaced in one shot. Co-Authored-By: Claude Sonnet 4.6 --- scripts/update-android.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-android.sh b/scripts/update-android.sh index 95411e18c..614e67d8d 100755 --- a/scripts/update-android.sh +++ b/scripts/update-android.sh @@ -5,7 +5,7 @@ cd $(dirname "$0")/../ file='gradle/libs.versions.toml' content=$(cat $file) -regex='(sentry = ")([0-9\.]+)' +regex='(sentry = ")([^"]+)' if ! [[ $content =~ $regex ]]; then echo "Failed to find the Android SDK version in $file" exit 1 From afdf31a1a0efc0b86684976c8714ea8b3ce1b3fc Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 1 Jun 2026 17:25:13 +0200 Subject: [PATCH 5/7] test(instrumentation): Stub removed sentry-android-okhttp event listener VisitorTest verifies instrumented bytecode against the real classes on the test classpath. After bumping sentry to 8.43.0, the test classpath provides sentry-okhttp instead of sentry-android-okhttp, so io.sentry.android.okhttp.SentryOkHttpEventListener no longer resolves. The classloader then generated an empty stub extending Object, which is not an okhttp3.EventListener subtype, so the eventListener() call in the legacy useSentryAndroidOkHttp path failed bytecode verification. Generate a stub for it that extends io.sentry.okhttp.SentryOkHttpEventListener, mirroring the real inheritance so the verifier accepts the call. Co-Authored-By: Claude Sonnet 4.6 --- .../instrumentation/classloader/mapping/OkHttpMapping.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt b/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt index 5bfcafb37..ecd5220a4 100644 --- a/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt +++ b/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt @@ -12,4 +12,10 @@ val okHttpMissingClasses = { name -> standardClassSource(name, superclass = "okhttp3.internal.Internal") }, + // Removed from the Sentry SDK in 8.0.0; generate a stub so the verifier can still + // resolve it for the legacy useSentryAndroidOkHttp instrumentation path. + "io.sentry.android.okhttp.SentryOkHttpEventListener" to + { name -> + standardClassSource(name, superclass = "io.sentry.okhttp.SentryOkHttpEventListener") + }, ) From 8251bf633a82c69f27e046a2fc122df15c5012ba Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 1 Jun 2026 17:30:01 +0200 Subject: [PATCH 6/7] test(build): Drop redundant AAR dependency on sentry-okhttp sentry-okhttp is a plain JVM library, so pulling it through the testImplementationAar (.aar -> .jar) configuration is unnecessary; the testImplementation entry already provides it on the test classpath. Co-Authored-By: Claude Sonnet 4.6 --- plugin-build/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index 7f4170428..91a7bcb58 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -60,7 +60,6 @@ dependencies { testRuntimeOnly(files(androidSdkPath)) testImplementationAar(libs.sentryAndroid) testImplementation(libs.sentryOkhttp) - testImplementationAar(libs.sentryOkhttp) // Needed to read contents from APK/Source Bundles testImplementation(libs.arscLib) From 465e571c9af4486f923c39ae3f0f1b4b3415fe29 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 2 Jun 2026 10:20:10 +0200 Subject: [PATCH 7/7] test(instrumentation): Pin sentry-android-okhttp for legacy okhttp test Verify the legacy useSentryAndroidOkHttp instrumentation path against the real io.sentry.android.okhttp.SentryOkHttpEventListener instead of a hand-written stub. The module was removed from the SDK in 8.0.0, so pin the test dependency to 7.22.6, its last release. No updater can bump it since no newer version of the artifact exists. Co-Authored-By: Claude Sonnet 4.6 --- gradle/libs.versions.toml | 5 +++++ plugin-build/build.gradle.kts | 1 + .../instrumentation/classloader/mapping/OkHttpMapping.kt | 6 ------ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a89d29206..3a66cb141 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,6 +6,10 @@ asm = "9.4" # // compatibility matrix -> https://developer.android.com/reference ktfmt = "0.51" sqlite = "2.1.0" sentry = "8.43.0" +# Pinned to the last release that shipped sentry-android-okhttp; the module was removed +# in 8.0.0, so there is no newer version to update to. Used only to verify the legacy +# okhttp instrumentation path in tests. +sentryAndroidOkhttp = "7.22.6" sampleCoroutines = "1.5.2" sampleRoom = "2.7.2" @@ -52,6 +56,7 @@ sqliteFramework = { group = "androidx.sqlite", name = "sqlite-framework", versio sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" } sentryAndroid = { group = "io.sentry", name = "sentry-android", version.ref = "sentry" } sentryOkhttp = { group = "io.sentry", name = "sentry-okhttp", version.ref = "sentry" } +sentryAndroidOkhttp = { group = "io.sentry", name = "sentry-android-okhttp", version.ref = "sentryAndroidOkhttp" } sentrySpringBootJakarta = { group = "io.sentry", name = "sentry-spring-boot-starter-jakarta", version.ref = "sentry" } # test diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index 91a7bcb58..38232b324 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -60,6 +60,7 @@ dependencies { testRuntimeOnly(files(androidSdkPath)) testImplementationAar(libs.sentryAndroid) testImplementation(libs.sentryOkhttp) + testImplementationAar(libs.sentryAndroidOkhttp) // Needed to read contents from APK/Source Bundles testImplementation(libs.arscLib) diff --git a/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt b/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt index ecd5220a4..5bfcafb37 100644 --- a/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt +++ b/plugin-build/src/test/kotlin/io/sentry/android/gradle/instrumentation/classloader/mapping/OkHttpMapping.kt @@ -12,10 +12,4 @@ val okHttpMissingClasses = { name -> standardClassSource(name, superclass = "okhttp3.internal.Internal") }, - // Removed from the Sentry SDK in 8.0.0; generate a stub so the verifier can still - // resolve it for the legacy useSentryAndroidOkHttp instrumentation path. - "io.sentry.android.okhttp.SentryOkHttpEventListener" to - { name -> - standardClassSource(name, superclass = "io.sentry.okhttp.SentryOkHttpEventListener") - }, )