Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/agp-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
agp: [ '8.7.0','8.8.0','8.9.0' ]
agp: [ '9.0.0', '9.1.1', '9.2.1' ]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reminder: we publish the entry-android artifact compiled against 9.2.1 as set in Config.kt below. this test compiles the sentry-android artifact against different versions of AGP meaning the tests do not represent our published artifact

integrations: [ true, false ]

name: AGP Matrix Release - AGP ${{ matrix.agp }} - Integrations ${{ matrix.integrations }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Backfill release, environment, distribution, tags, and app version/build—and use the matching replay-on-error sample rate—for `ApplicationExitInfo` ANR and native crash events captured before SDK initialization, without reusing options cached by a later app update ([#5762](https://github.com/getsentry/sentry-java/pull/5762))

### Dependencies

- The SDK is now compiled with Android Gradle Plugin 9.2.1 ([#5779](https://github.com/getsentry/sentry-java/pull/5779))

## 8.49.0

### Features
Expand Down
26 changes: 26 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ allprojects {
subprojects {
apply { plugin("io.sentry.spotless") }

// AGP 9.2 bundles lint 9.2.1, which flags compileSdk 36 as outdated because 37 is available.
// We intentionally stay on compileSdk 36 until the API 37 bump (#5768), so silence that check
// for every Android module (library and application).
pluginManager.withPlugin("com.android.library") {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we should remove this once we bump to compile/target sdk 37

extensions.configure<com.android.build.gradle.BaseExtension> {
Comment thread
runningcode marked this conversation as resolved.
lintOptions { disable("GradleDependency") }
}
}
pluginManager.withPlugin("com.android.application") {
extensions.configure<com.android.build.gradle.BaseExtension> {
lintOptions { disable("GradleDependency") }
}
}

plugins.withId(Config.QualityPlugins.detektPlugin) {
configure<DetektExtension> {
buildUponDefaultConfig = true
Expand Down Expand Up @@ -168,6 +182,18 @@ subprojects {
}
}

// AGP 9 defaults Android modules to Java 11. Pin the published library modules back
// to Java 8 so their bytecode stays consumable by Java 8 projects, mirroring the
// java-library pin above.
plugins.withId("com.android.library") {
configure<com.android.build.gradle.BaseExtension> {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
}

apply<MavenPublishPlugin>()

afterEvaluate {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

object Config {
val AGP = System.getenv("VERSION_AGP") ?: "8.13.1"
val AGP = System.getenv("VERSION_AGP") ?: "9.2.1"
val kotlinStdLib = "stdlib-jdk8"
val kotlinStdLibVersionAndroid = "1.9.24"
val kotlinTestJunit = "test-junit"
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

# AndroidX required by AGP >= 3.6.x
android.useAndroidX=true
android.experimental.lint.version=8.13.1
# AGP 9+ migration opt-outs until we remove kotlin-android plugin and adopt built-in Kotlin.
android.builtInKotlin=false
android.newDsl=false
android.experimental.lint.version=9.2.1

# Release information
versionName=8.49.0
Expand Down
7 changes: 6 additions & 1 deletion sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import net.ltgt.gradle.errorprone.errorprone
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8

plugins {
id("com.android.library")
Expand Down Expand Up @@ -33,7 +34,11 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }
// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
testBuildType = "release"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Release tests forced outside CI

Medium Severity

testBuildType = "release" is applied unconditionally, but debug variants are only disabled in CI via shouldSkipDebugVariant. Locally, that removes testDebugUnitTest even though debug is still enabled, so the documented testDebugUnitTest workflow no longer works.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7d0c248. Configure here.


kotlin { compilerOptions.jvmTarget = JVM_1_8 }

testOptions {
animationsDisabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public SentryFrameMetricsCollector(
}

@SuppressWarnings("deprecation")
@SuppressLint({"NewApi", "PrivateApi"})
@SuppressLint({"NewApi", "PrivateApi", "DiscouragedPrivateApi"})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is the Choreographer.class.getDeclaredField("mLastFrameTimeNanos"); on line 144

public SentryFrameMetricsCollector(
final @NotNull Context context,
final @NotNull ILogger logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
android:layout_height="wrap_content"
android:hint="Your Name"
android:inputType="textPersonName"
android:autofillHints="name"
android:background="@drawable/sentry_edit_text_border"
android:paddingHorizontal="8dp"
android:layout_below="@id/sentry_dialog_user_feedback_txt_name" />
Expand All @@ -66,6 +67,7 @@
android:layout_height="wrap_content"
android:hint="[email protected]"
android:inputType="textEmailAddress"
android:autofillHints="emailAddress"
android:background="@drawable/sentry_edit_text_border"
android:paddingHorizontal="8dp"
android:layout_below="@id/sentry_dialog_user_feedback_txt_email" />
Expand All @@ -85,6 +87,7 @@
android:layout_height="wrap_content"
android:lines="6"
android:inputType="textMultiLine"
android:importantForAutofill="no"
android:gravity="top|left"
android:hint="What's the bug? What did you expect?"
android:background="@drawable/sentry_edit_text_border"
Expand Down
7 changes: 6 additions & 1 deletion sentry-android-distribution/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
Expand All @@ -12,6 +13,10 @@ android {
defaultConfig { minSdk = libs.versions.minSdk.get().toInt() }
buildFeatures { buildConfig = false }

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
testBuildType = "release"

testOptions {
unitTests.apply {
isReturnDefaultValues = true
Expand All @@ -21,7 +26,7 @@ android {
}

kotlin {
jvmToolchain(17)
compilerOptions.jvmTarget = JVM_1_8
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
explicitApi()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.Config

@RunWith(AndroidJUnit4::class)
@Config(sdk = [35])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we should investigate and/or update robolectric to fix the failure this was causing in a separate PR

class UpdateResponseParserTest {

private lateinit var options: SentryOptions
Expand Down
12 changes: 9 additions & 3 deletions sentry-android-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
id("com.android.library")
Expand All @@ -23,10 +25,14 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
}

testOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io.gitlab.arturbosch.detekt.Detekt
import net.ltgt.gradle.errorprone.errorprone
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.application")
Expand Down Expand Up @@ -64,12 +65,12 @@ android {
}
}

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }
kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 }

lint {
warningsAsErrors = true
checkDependencies = true
// Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36
// Suppress OldTargetApi: lint 9.2.1 expects API 37 but we target 36

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we should remove this once we bump the SDK

disable += "OldTargetApi"

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.application")
Expand Down Expand Up @@ -31,7 +32,7 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }
kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AGP defaults to 11 now. Since these are our UI tests, it doesn't affect the compiled artifact.

buildFeatures { compose = true }
composeOptions { kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() }
androidComponents.beforeVariants {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11

plugins {
id("com.android.test")
alias(libs.plugins.kotlin.android)
Expand Down Expand Up @@ -30,7 +32,7 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 }
kotlin { compilerOptions.jvmTarget = JVM_11 }

targetProjectPath = ":sentry-samples:sentry-samples-android"
// Run the test in its own process so it measures the target app cold, not itself.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io.gitlab.arturbosch.detekt.Detekt
import net.ltgt.gradle.errorprone.errorprone
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.application")
Expand Down Expand Up @@ -56,18 +57,19 @@ android {
buildTypes {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.getByName("debug") // to be able to run release mode
testProguardFiles("proguard-rules.pro")
}
}

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }
kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 }

lint {
warningsAsErrors = true
checkDependencies = true
// Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36
// Suppress OldTargetApi: lint 9.2.1 expects API 37 but we target 36
disable += "OldTargetApi"

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
Expand Down
12 changes: 9 additions & 3 deletions sentry-android-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
id("com.android.library")
Expand All @@ -23,10 +25,14 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.jvmTarget = JVM_1_8
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
}

testOptions {
Expand Down
4 changes: 4 additions & 0 deletions sentry-android-ndk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
testBuildType = "release"

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }

testOptions {
Expand Down
17 changes: 10 additions & 7 deletions sentry-android-replay/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
Expand All @@ -25,20 +27,21 @@ android {

buildFeatures { compose = true }

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
useLiveLiterals = false
}
composeOptions { kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() }

buildTypes {
getByName("debug") { consumerProguardFiles("proguard-rules.pro") }
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
}

testOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import kotlin.test.Test
import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.mockito.kotlin.mock
import org.robolectric.annotation.Config

@RunWith(AndroidJUnit4::class)
@Config(sdk = [35])
class ScreenshotRecorderTest {

internal class Fixture() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.robolectric.Robolectric.buildActivity
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config

@RunWith(AndroidJUnit4::class)
@Config(sdk = [35])
class ViewsTest {

@BeforeTest
Expand Down
12 changes: 9 additions & 3 deletions sentry-android-sqlite/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
id("com.android.library")
Expand All @@ -23,10 +25,14 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
}

testOptions {
Expand Down
Loading
Loading