Anamorphosee / stacktrace-decoroutinator

Small lib for recovering stack trace in exceptions thrown in Kotlin coroutines
Apache License 2.0
158 stars 4 forks source link

NullPointerException on Android #14

Closed saket closed 6 months ago

saket commented 1 year ago

Hey @Anamorphosee, I'm running into this crash when trying to use SD on Android:

Caused by: java.lang.NullPointerException: it must not be null
        at dev.reformator.stacktracedecoroutinator.runtime.DecoroutinatorRuntime.load(runtime-android.kt:38)
        at dev.reformator.stacktracedecoroutinator.runtime.DecoroutinatorRuntime.load$default(runtime-android.kt:24)

The android artifact isn't an AAR so I wasn't able to step into the sources to debug what exactly is null. I was testing on Android 13.

Anamorphosee commented 1 year ago

Hi, @saket. Could you please check if there is a file decoroutinatorBaseContinuation.dex in your APK? And how do you declare a dependency on SD?

It's an AAR artifact https://repo1.maven.org/maven2/dev/reformator/stacktracedecoroutinator/stacktrace-decoroutinator-android/2.3.3/stacktrace-decoroutinator-android-2.3.3.aar

astuetz commented 1 year ago

Hi, I'm running into the same problem. I included the dependency as described on your readme for Android. Also there's no decoroutinatorBaseContinuation.dex inside the apk.

Anamorphosee commented 1 year ago

@astuetz Hi, maybe ProGuard deletes the file decoroutinatorBaseContinuation.dex in build time. Could you please check, if the file present if you build with

shrinkResources false
minifyEnabled false

?

saket commented 7 months ago

@Anamorphosee this is happening in debug builds where code minification isn't enabled

Anamorphosee commented 6 months ago

Fixed in 2.3.8. @saket Could you check please?

saket commented 6 months ago

Thanks, that was quick. I'll try it out and report back!

saket commented 6 months ago

Your fix works, but I'm now running into https://github.com/Anamorphosee/stacktrace-decoroutinator/issues/23 🙂.