Hello all, I have built a KMP module with view in ...
# multiplatform
a
Hello all, I have built a KMP module with view in CMP. I'm using this KMP module in my existing Android application with a goal to reuse the CMP UI in my iOS App through the KMP module. However, when I try to inflate the CMP view in my existing activity, I get the following error:
Copy code
java.lang.AbstractMethodError: abstract method "kotlin.coroutines.CoroutineContext$Key androidx.compose.runtime.MonotonicFrameClock.getKey()"
                                                                                                    	at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:33)
                                                                                                    	at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:32)
                                                                                                    	at kotlin.coroutines.CoroutineContext$Element$DefaultImpls.fold(CoroutineContext.kt:70)
                                                                                                    	at androidx.compose.runtime.MonotonicFrameClock$DefaultImpls.fold(MonotonicFrameClock.kt:27)
                                                                                                    	at androidx.compose.ui.platform.AndroidUiFrameClock.fold(AndroidUiFrameClock.android.kt:24)
                                                                                                    	at kotlin.coroutines.CoroutineContext$DefaultImpls.plus(CoroutineContext.kt:32)
                                                                                                    	at kotlin.coroutines.CoroutineContext$Element$DefaultImpls.plus(CoroutineContext.kt:59)
                                                                                                    	at kotlin.coroutines.AbstractCoroutineContextElement.plus(CoroutineContextImpl.kt:14)
                                                                                                    	at androidx.compose.ui.platform.AndroidUiDispatcher$Companion$Main$2.invoke(AndroidUiDispatcher.android.kt:162)
                                                                                                    	at androidx.compose.ui.platform.AndroidUiDispatcher$Companion$Main$2.invoke(AndroidUiDispatcher.android.kt:155)
                                                                                                    	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
                                                                                                    	at androidx.compose.ui.platform.AndroidUiDispatcher$Companion.getMain(AndroidUiDispatcher.android.kt:155)
                                                                                                    	at androidx.compose.ui.platform.AndroidUiDispatcher$Companion.getCurrentThread(AndroidUiDispatcher.android.kt:184)
                                                                                                    	at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer(WindowRecomposer.android.kt:334)
                                                                                                    	at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer$default(WindowRecomposer.android.kt:325)
                                                                                                    	at androidx.compose.ui.platform.WindowRecomposerFactory$Companion.LifecycleAware$lambda$0(WindowRecomposer.android.kt:168)
                                                                                                    	at androidx.compose.ui.platform.WindowRecomposerFactory$Companion.$r8$lambda$PmWZXv-2LDhDmANvYhil4YZYJuQ(Unknown Source:0)
                                                                                                    	at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$$ExternalSyntheticLambda0.createRecomposer(Unknown Source:0)
                                                                                                    	at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.android.kt:224)
                                                                                                    	at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(WindowRecomposer.android.kt:300)
                                                                                                    	at androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext(ComposeView.android.kt:244)
                                                                                                    	at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.android.kt:251)
                                                                                                    	at androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow(ComposeView.android.kt:283)
                                                                                                    	at android.view.View.dispatchAttachedToWindow(View.java:21980)
                                                                                                    	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
                                                                                                    	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                                                                                                    	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                                                                                                    	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                                                                                                    	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3014)
                                                                                                    	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2465)
                                                                                                    	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9305)
                                                                                                    	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1339)
                                                                                                    	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
                                                                                                    	at android.view.Choreographer.doCallbacks(Choreographer.java:952)
                                                                                                    	at android.view.Choreographer.doFrame(Choreographer.java:882)
                                                                                                    	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Has anyone encountered this before? Can someone please help me identify the fix for this?
🧵 3
p
Make sure you depend on the same compose and coroutine versions in the library and the consumer project