dd-sdk-android icon indicating copy to clipboard operation
dd-sdk-android copied to clipboard

Crash due to NPE from WindowCallbackWrapper.dispatchTouchEvent

Open DawnNguyenAhiho opened this issue 11 months ago • 2 comments

Stack trace

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'boolean android.view.ViewGroup.getTouchscreenBlocksFocus()' on a null object reference
____________________
com.datadog.android.rum.internal.instrumentation.gestures.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.kt:69)
___________________

Reproduction steps

Can't reproduce, can only notice on Crashlytics and Google Play Console

Volume

2%

Affected SDK versions

2.10.1

Latest working SDK version

I implemented 2.10.1 at first til now

Does the crash manifest in the latest SDK version?

Yes

Kotlin / Java version

2.0.10

Gradle / AGP version

8.6.0

Other dependencies versions

composeBom = "2024.12.01"

Device Information

No response

Other relevant information

I'm using JetpackCompose for my app. Due to FirebaseCrashlytics, the crash occur at a screen that has a LazyColum, a TextField. When scroll the lazy column, I called softwareKeyboardController?.hide() to hide the soft keyboard. Don't know does it cause the crash or not

DawnNguyenAhiho avatar Jan 24 '25 04:01 DawnNguyenAhiho

Hi @DawnNguyenAhiho ,

this is an issue we've heard about in the past. In theory, the event passed into the Window.Callback.dispatchTouchEvent(MotionEvent event) method is supposed to be non null, and most of the time it is. But sometimes (and unfortunately we don't know why), a null value is passed from the Touch manager, in the Android Framework.

The line of code that appears in the callstack comes from our WindowCallbackWrapper, which uses the event to capture use interaction, and then forwards it to the original Window callback.

So even though it does appear in the callstack, it actually doesn't cause the crash. The root cause is something that somehow sends a null event to the window wrapper. Do the errors you get from Crashlytics show you a specific OS version or Device for this crash?

xgouchet avatar Jan 24 '25 10:01 xgouchet

Hi @xgouchet, thank for your reply. According to Google Play Console Crash report, this is the report of crash by Device and OS Version. Hope this will help

Image

Image

DawnNguyenAhiho avatar Feb 03 '25 06:02 DawnNguyenAhiho

Hello @DawnNguyenAhiho!

Can you please provide a full stacktrace if the issue still occurs?

0xnm avatar Jun 17 '25 09:06 0xnm

@0xnm After deeper investigation, look like it is the issue from the LazyColumn duplicate key, and then some how datadog throw it, so that Play Console log that the issue is from data dog, but actually the root cause is the LazyColumn from Jetpack Compose, and now look like it does not occur anymore

DawnNguyenAhiho avatar Jun 17 '25 09:06 DawnNguyenAhiho