I'd like more insights in my coroutine stacktraces...
# coroutines
e
I'd like more insights in my coroutine stacktraces of production crashes on Android. I use Firebase Crashlytics) and I came across: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-debug/ On Android it seems hard to make this work. I added the coroutines-debug dependency, the aspectj-gradle-android plugin and in my application
onCreate
I call
DebugProbes.install()
. Running the app leads to an immediate crash about
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/R$string
. 😞 (Note that I don't even need to call
DebugProbes.install()
, so the issue lies elsewhere). Has anybody got experience with debugging Android coroutine stacktraces in production, or any other tips on how to do this?
g
Unfortunately, Android runtime does not support Instrument API necessary for kotlinx-coroutines-debug to function
What exactly you want to improve? Standard coroutine debug already improves stacktraces, what is your exact problem?
e
I want to see the files and line numbers in my code base that lead to the point of crash. However, by default (no debugging), the stack traces show all kinds of coroutine internals being called. That makes sense, but is not helpful.
What do you mean by 'standard coroutine debug'?
e
Is that simply enabled by setting it e.g. through some line in a Gradle script or properties file?
g
It can be enabled either by setting system property DEBUG_PROPERTY_NAME
not in properties file
you are on Android, so the easiest way is just set it on runtime on App start:
Copy code
System.setProperty(DEBUG_PROPERTY_NAME, DEBUG_PROPERTY_VALUE_ON)
e
Thanks. I did that already, but I want sure if that was a common way of doing it. Thanks for the help!