Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
- Decide whether foregrounding the app starts a new session on a monotonic clock instead of the wall clock, so that a device time change no longer starts a session that should have been resumed, or resumes one that should have ended. This affects session counts ([#6096](https://github.com/getsentry/sentry-java/pull/6096))
- `SentryUserFeedbackForm` now extends `android.app.Dialog` instead of `android.app.AlertDialog` ([#6338](https://github.com/getsentry/sentry-java/pull/6338))
- The form never used `AlertDialog` features. Code that calls `AlertDialog`-only methods on it, such as `setButton` or `setMessage`, no longer compiles.
- Raise the minimum supported Android API level (`minSdk`) of all Android modules from 21 to 24. Apps with a lower `minSdk` must raise it or stay on 8.x ([#6518](https://github.com/getsentry/sentry-java/pull/6518))
- `sentry-android` no longer includes `sentry-android-ndk` as a default dependency. Instead, tombstone reporting is enabled by default, which provides more detailed native crashes on Android 11+ (API 30). If you're using sentry-android-ndk APIs, or need native crashes on Android 10 and lower, manually add the `io.sentry:sentry-android-ndk` dependency to your app. ([#6436](https://github.com/getsentry/sentry-java/pull/6436))
- Remove the Android `enablePerformanceV2` option and its `io.sentry.performance-v2.enable` manifest metadata. Performance V2 is always on ([#6458](https://github.com/getsentry/sentry-java/pull/6458))
- App starts are measured from process start on Android 7.0+ (API 24), and slow and frozen frames are measured per span
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ Sentry SDK for Java and Android

| Packages | Maven Central | Minimum Android API Version |
|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| ------- |
| sentry-android | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android) | 21 |
| sentry-android-core | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-core?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-core) | 21 |
| sentry-android-distribution | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-distribution?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-distribution) | 21 |
| sentry-android-ndk | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-ndk?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-ndk) | 21 |
| sentry-android-timber | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-timber?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-timber) | 21 |
| sentry-android-fragment | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-fragment?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-fragment) | 21 |
| sentry-android-navigation | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-navigation?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-navigation) | 21 |
| sentry-android-navigation3 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-navigation3?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-navigation3) | 23 |
| sentry-android-sqlite | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-sqlite?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-sqlite) | 21 |
| sentry-android | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android) | 24 |
| sentry-android-core | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-core?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-core) | 24 |
| sentry-android-distribution | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-distribution?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-distribution) | 24 |
| sentry-android-ndk | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-ndk?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-ndk) | 24 |
| sentry-android-timber | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-timber?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-timber) | 24 |
| sentry-android-fragment | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-fragment?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-fragment) | 24 |
| sentry-android-navigation | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-navigation?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-navigation) | 24 |
| sentry-android-navigation3 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-navigation3?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-navigation3) | 24 |
| sentry-android-sqlite | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-sqlite?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-sqlite) | 24 |
| sentry-android-replay | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-replay?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-replay) | 26 |
| sentry-compose-android | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose-android?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-compose-android) | 21 |
| sentry-compose-android | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose-android?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-compose-android) | 24 |
| sentry-compose-desktop | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose-desktop?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-compose-desktop) |
| sentry-compose | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-compose) |
| sentry | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry) | 21 |
Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ buildscript {
google()
}
dependencies {
// R8 must come before AGP on the classpath to replace the R8 bundled with AGP.
Config.BuildPlugins.r8?.let { classpath(it) }
classpath(Config.BuildPlugins.androidGradle)

// add classpath of sentry android gradle plugin
Expand Down
5 changes: 5 additions & 0 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ object Config {

object BuildPlugins {
val androidGradle = "com.android.tools.build:gradle:$AGP"

// The R8 bundled with AGP 9.0 and 9.2 crashes on androidx.core at minSdk 24, so builds that

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.

See discussion here for more info: https://github.com/getsentry/sentry-java/pull/6435/changes#diff-7ec293fa4699b0f55ddf8c807fa0e05b742fbeb35be17d9800e39a6211941e77R11

Basically this is only happening to us on old AGP versions. Upgrading them fixes it.

// override AGP (the AGP matrix) run the R8 that ships with the default AGP instead.
val r8: String?
get() = if (System.getenv("VERSION_AGP") != null) "com.android.tools:r8:9.4.14" else null
}

object Android {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sqldelight = "2.3.2"
targetSdk = "37"
compileSdk = "37"
compileSdkMinor = "2"
minSdk = "21"
minSdk = "24"

[plugins]
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static io.sentry.IConnectionStatusProvider.ConnectionStatus.DISCONNECTED;
import static java.util.concurrent.TimeUnit.SECONDS;

import android.os.Build;
import io.sentry.CompositePerformanceCollector;
import io.sentry.DataCategory;
import io.sentry.IContinuousProfiler;
Expand Down Expand Up @@ -176,10 +175,6 @@ private void initScopes() {
private void start() {
initScopes();

// Debug.startMethodTracingSampling() is only available since Lollipop, but Android Profiler
// causes crashes on api 21 -> https://github.com/getsentry/sentry-java/issues/3392
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) return;

// Let's initialize trace folder and profiling interval
init();
// init() didn't create profiler, should never happen
Expand Down Expand Up @@ -281,12 +276,6 @@ private void stop(final boolean restartProfiler) {
return;
}

// onTransactionStart() is only available since Lollipop_MR1
// and SystemClock.elapsedRealtimeNanos() since Jelly Bean
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) {
return;
}

List<PerformanceCollectionData> performanceCollectionData = null;
if (performanceCollector != null) {
performanceCollectionData = performanceCollector.stop(chunkId.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.android.core;

import android.annotation.SuppressLint;
import android.os.Debug;
import android.os.Process;
import android.os.SystemClock;
Expand Down Expand Up @@ -116,7 +115,6 @@ public AndroidProfiler(
Objects.requireNonNull(frameMetricsCollector, "SentryFrameMetricsCollector is required");
}

@SuppressLint("NewApi")
public @Nullable ProfileStartData start() {
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
// intervalUs is 0 only if there was a problem in the init
Expand Down Expand Up @@ -225,7 +223,6 @@ public void onFrameMetricCollected(
}
}

@SuppressLint("NewApi")
public @Nullable ProfileEndData endAndCollect(
final boolean isTimeout,
final @Nullable List<PerformanceCollectionData> performanceCollectionData) {
Expand Down Expand Up @@ -299,7 +296,6 @@ public void close() {
}
}

@SuppressLint("NewApi")
private void putPerformanceCollectionDataInMeasurements(
final @Nullable List<PerformanceCollectionData> performanceCollectionData) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static java.util.concurrent.TimeUnit.SECONDS;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import io.sentry.DateUtils;
Expand Down Expand Up @@ -151,10 +150,6 @@ private void init() {

@Override
public void start() {
// Debug.startMethodTracingSampling() is only available since Lollipop, but Android Profiler
// causes crashes on api 21 -> https://github.com/getsentry/sentry-java/issues/3392
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) return;

// When the first transaction is starting, we can start profiling
if (!isRunning.getAndSet(true)) {
// Let's initialize trace folder and profiling interval
Expand All @@ -179,7 +174,6 @@ public void start() {
}
}

@SuppressLint("NewApi")
private boolean onFirstStart() {
// init() didn't create profiler, should never happen
if (profiler == null) {
Expand Down Expand Up @@ -225,7 +219,6 @@ public void bindTransaction(final @NotNull ITransaction transaction) {
options);
}

@SuppressLint("NewApi")
private @Nullable ProfilingTraceData onTransactionFinish(
final @NotNull String transactionName,
final @NotNull String transactionId,
Expand All @@ -234,11 +227,6 @@ public void bindTransaction(final @NotNull ITransaction transaction) {
final @Nullable List<PerformanceCollectionData> performanceCollectionData,
final @NotNull SentryOptions options) {

// onTransactionStart() is only available since Lollipop_MR1
// and SystemClock.elapsedRealtimeNanos() since Jelly Bean
// and SUPPORTED_ABIS since KITKAT
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) return null;

// check if profiler was created
if (profiler == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public AnrV2Integration(final @NotNull Context context) {
this.dateProvider = dateProvider;
}

@SuppressLint("NewApi") // we do the check in the AnrIntegrationFactory
@Override
public void register(@NotNull IScopes scopes, @NotNull SentryOptions options) {
this.options =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static io.sentry.cache.PersistingScopeObserver.USER_FILENAME;
import static io.sentry.protocol.Contexts.REPLAY_ID;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageInfo;
Expand Down Expand Up @@ -728,7 +727,6 @@ private void setDevice(final @NotNull SentryBaseEvent event) {

// only use static data that does not change between app launches (e.g. timezone, boottime,
// battery level will change)
@SuppressLint("NewApi")
private @NotNull Device getDevice() {
Device device = new Device();
device.setManufacturer(Build.MANUFACTURER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ static PackageInfo getPackageInfo(
*
* @return the Application's ApplicationInfo if possible, or throws
*/
@SuppressLint("NewApi")
@Nullable
@SuppressWarnings("deprecation")
static ApplicationInfo getApplicationInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ private void setDeviceIO(
}
}

@SuppressWarnings("NewApi")
@NotNull
private TimeZone getTimeZone() {
// Only use the costly Calendar API on Android 13+ (API Level 33+) when the locale contains a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions

if (androidOptions.isEnableNetworkEventBreadcrumbs()) {

// The specific error is logged in the ConnectivityChecker method
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.N) {
options.getLogger().log(SentryLevel.DEBUG, "NetworkCallbacks need Android N+.");
return;
}

try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
networkCallback =
new NetworkBreadcrumbsNetworkCallback(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.android.core;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.os.Process;
Expand Down Expand Up @@ -91,7 +90,6 @@ public static void init(
* @param logger your custom logger that implements ILogger
* @param configuration Sentry.OptionsConfiguration configuration handler
*/
@SuppressLint("NewApi")
public static void init(
@NotNull final Context context,
@NotNull ILogger logger,
Expand Down Expand Up @@ -154,11 +152,9 @@ public static void init(
// if SentryPerformanceProvider was disabled or removed,
// we set the app start / sdk init time here instead
final @NotNull AppStartMetrics appStartMetrics = AppStartMetrics.getInstance();
if (buildInfoProvider.getSdkInfoVersion() >= android.os.Build.VERSION_CODES.N) {
final @NotNull TimeSpan appStartTimeSpan = appStartMetrics.getAppStartTimeSpan();
if (appStartTimeSpan.hasNotStarted()) {
appStartTimeSpan.setStartedAt(Process.getStartUptimeMillis());
}
final @NotNull TimeSpan appStartTimeSpan = appStartMetrics.getAppStartTimeSpan();
if (appStartTimeSpan.hasNotStarted()) {
appStartTimeSpan.setStartedAt(Process.getStartUptimeMillis());
}
if (context.getApplicationContext() instanceof Application) {
appStartMetrics.registerLifecycleCallbacks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static io.sentry.Sentry.APP_START_PROFILING_CONFIG_FILE_NAME;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.content.pm.ProviderInfo;
Expand Down Expand Up @@ -250,20 +249,15 @@ private void createAndStartTransactionProfiler(
appStartProfiler.start();
}

@SuppressLint("NewApi")
private void onAppLaunched(
final @Nullable Context context, final @NotNull AppStartMetrics appStartMetrics) {

// sdk-init uses static field init as start time
final @NotNull TimeSpan sdkInitTimeSpan = appStartMetrics.getSdkInitTimeSpan();
sdkInitTimeSpan.setStartedAt(sdkInitMillis);

// performance v2: Uses Process.getStartUptimeMillis()
// requires API level 24+
if (buildInfoProvider.getSdkInfoVersion() >= android.os.Build.VERSION_CODES.N) {
final @NotNull TimeSpan appStartTimespan = appStartMetrics.getAppStartTimeSpan();
appStartTimespan.setStartedAt(Process.getStartUptimeMillis());
}
final @NotNull TimeSpan appStartTimespan = appStartMetrics.getAppStartTimeSpan();
appStartTimespan.setStartedAt(Process.getStartUptimeMillis());

if (context instanceof Application) {
app = (Application) context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.android.core.internal.gestures;

import android.annotation.SuppressLint;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
Expand Down Expand Up @@ -115,7 +114,6 @@ public boolean onSearchRequested() {
return delegate.onSearchRequested();
}

@SuppressLint("NewApi")
@Override
public boolean onSearchRequested(SearchEvent searchEvent) {
return delegate.onSearchRequested(searchEvent);
Expand All @@ -127,7 +125,6 @@ public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
return delegate.onWindowStartingActionMode(callback);
}

@SuppressLint("NewApi")
@Nullable
@Override
public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i) {
Expand Down
Loading
Loading