Skip to content

java.lang.RuntimeException: Can't create handler inside thread Thread[DefaultDispatcher-worker-3,5,main] that has not called Looper.prepare() with Sentry 8.12.0 #4438

Closed
@rvandermeulen

Description

@rvandermeulen

Integration

sentry-android

Build System

Gradle

AGP Version

8.9.0

Proguard

Enabled

Version

8.12.0

Steps to Reproduce

N/A

Expected Result

No crashing.

Actual Result

Sorry, I don't have good STR here as this is from crash reports we're receiving in the wild. We recently updated from version 8.9.0 to 8.12.0 and saw a spike in crashes with the exception & stack:

java.lang.RuntimeException: Can't create handler inside thread Thread[DefaultDispatcher-worker-3,5,main] that has not called Looper.prepare()
	at android.os.Handler.<init>(Handler.java:228)
	at android.os.Handler.<init>(Handler.java:130)
	at android.view.GestureDetector$GestureHandler.<init>(GestureDetector.java:343)
	at android.view.GestureDetector.<init>(GestureDetector.java:504)
	at android.view.GestureDetector.<init>(GestureDetector.java:476)
	at androidx.core.view.GestureDetectorCompat.<init>(GestureDetectorCompat.java:3)
	at androidx.core.view.GestureDetectorCompat.<init>(GestureDetectorCompat.java:1)
	at io.sentry.android.core.internal.gestures.SentryWindowCallback.<init>(SentryWindowCallback.java:3)
	at io.sentry.android.core.UserInteractionIntegration.startTracking(UserInteractionIntegration.java:63)
	at io.sentry.android.core.UserInteractionIntegration.register(UserInteractionIntegration.java:128)
	at io.sentry.Sentry.init(Sentry.java:348)
	at mozilla.components.lib.crash.sentry.SentryService.initSentry$lib_crash_sentry_release(SentryService.kt:33)
	at mozilla.components.lib.crash.sentry.SentryService.initIfNeeded(SentryService.kt:8)
	at mozilla.components.lib.crash.sentry.SentryService.prepareReport$lib_crash_sentry_release(SentryService.kt:6)
	at mozilla.components.lib.crash.sentry.SentryService.report(SentryService.kt:9)
	at mozilla.components.lib.crash.CrashReporter$submitCaughtException$1.invokeSuspend(CrashReporter.kt:43)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:116)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:4)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:3)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:94)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: null

We do delay Sentry initialization in our app, so I'm wondering if the changes related to that in 8.12.0 are related.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions