stacktrace-decoroutinator icon indicating copy to clipboard operation
stacktrace-decoroutinator copied to clipboard

java.lang.IllegalStateException: Stacktrace-decoroutinator runtime can not be loaded because BaseContinuationImpl was already loaded.

Open kenny-statsig opened this issue 2 years ago • 4 comments

I am calling DecoroutinatorRuntime.load() at the top of my app's onCreate but it seems to be causing the app to crash I've attached a screenshot of the full stack trace.

Screenshot 2023-06-22 at 1 50 43 PM

kenny-statsig avatar Jun 22 '23 20:06 kenny-statsig

@kenny-statsig It seems you add a call of DecoroutinatorRuntime.load() to the MainActivity's onCreate() method instead of the Application's one. Please see the correct example from the Android tests. https://github.com/Anamorphosee/stacktrace-decoroutinator/blob/master/stacktrace-decoroutinator-android/src/androidTest/AndroidManifest.xml https://github.com/Anamorphosee/stacktrace-decoroutinator/blob/master/stacktrace-decoroutinator-android/src/androidTest/kotlin/utils-test.kt#L31

Anamorphosee avatar Jun 22 '23 23:06 Anamorphosee

I encountered the same issue. I had the .load() setup correctly in our Application class and still ran into this issue. Tried moving it to the init {...}, but same result. We are using dependency injection (Hilt), and some of the injected classes has coroutines in their init(), which might be the issue? 🤔 I did not find a workaround

MarcLFJ avatar Jul 07 '23 08:07 MarcLFJ

I first tried using the suggested onCreate, but got that same "BaseContinuationImpl was already loaded" error. I switched to use the init{} block in my Application file and things started working!

I'd bet that having coroutines in your hilt stuff is what's causing the BaseContinuationImpl to be loaded before you'd like. I don't know a solution for you, but wanted to say that your init trick is greatly appreciated!

jhollowayj avatar Jan 11 '24 01:01 jhollowayj

That did the trick, thank you!

saket avatar Jan 29 '24 08:01 saket

Just released SD version 2.4.1 with a big rework for Android. From now on SD for Android requires only the Gradle plugin and no other dependencies or method calls are required.

Anamorphosee avatar Aug 02 '24 12:08 Anamorphosee