Previews problem in KMP, s again. ```@Composable ...
# compose
a
Previews problem in KMP, s again.
Copy code
@Composable
fun IconTest(
) {
    Icon(
      // imageVector= vectorResource(Res.drawable.eye_off_icon),
        imageVector = Icons.Filled.ExpandMore,
        contentDescription = null,
        tint = MaterialTheme.colorScheme.primary,
        modifier = Modifier
            .padding(vertical = 32.dp)
    )
}
with vectorResource there are problems.. with material icon works.
java.lang.NullPointerException at layoutlib.internal.kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith ... (ContinuationImpl.kt:34) at layoutlib.internal.kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at layoutlib.internal.kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277) at layoutlib.internal.kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95) at layoutlib.internal.kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69) at layoutlib.internal.kotlinx.coroutines.BuildersKt.runBlocking at layoutlib.internal.kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48) at layoutlib.internal.kotlinx.coroutines.BuildersKt.runBlocking$default at com.plcoding.core.designsystem.components.buttons.IconTestKt.IconTest ... (IconTest.kt:22) at com.plcoding.core.designsystem.components.buttons.IconTestKt.IconTestPreview(IconTest.kt:33) at jdk.internal.reflect.DirectMethodHandleAccessor.invoke at java.lang.reflect.Method.invoke at androidx.compose.ui.tooling.ComposableInvoker.invokeComposableMethod(ComposableInvoker.jvm.kt:185) at androidx.compose.ui.tooling.ComposableInvoker.invokeComposable(ComposableInvoker.jvm.kt:222) at androidx.compose.ui.tooling.ComposeViewAdapter$init$3$1.invoke$lambda$1$lambda$0(ComposeViewAdapter.android.kt:451) at androidx.compose.ui.tooling.ComposeViewAdapter$init$3$1.invoke(ComposeViewAdapter.android.kt:492) at androidx.compose.ui.tooling.ComposeViewAdapter$init$3$1.invoke(ComposeViewAdapter.android.kt:442) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:370) at androidx.compose.ui.tooling.InspectableKt.Inspectable(Inspectable.android.kt:58) at androidx.compose.ui.tooling.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.android.kt:391) at androidx.compose.ui.tooling.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.android.kt:390) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:370) at androidx.compose.ui.tooling.ComposeViewAdapter.WrapPreview(ComposeViewAdapter.android.kt:385) at androidx.compose.ui.tooling.ComposeViewAdapter.access$WrapPreview(ComposeViewAdapter.android.kt:123) at androidx.compose.ui.tooling.ComposeViewAdapter$init$3.invoke(ComposeViewAdapter.android.kt:442) at androidx.compose.ui.tooling.ComposeViewAdapter$init$3.invoke(ComposeViewAdapter.android.kt:439) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51) at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:431) at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:250) at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:250) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:370) at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:216) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:145) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:144) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:370) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:133) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:140) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:139) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:390) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:139) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:123) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51) at androidx.compose.runtime.internal.Expect_jvmKt.invokeComposable(Expect.jvm.kt:24) at androidx.compose.runtime.ComposerImpl.doCompose-aFTiNEg(Composer.kt:3843) at androidx.compose.runtime.ComposerImpl.composeContent--ZbOJvo$runtime(Composer.kt:3747) at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:832) at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1234) at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:672) at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:639) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:123) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:114) at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1990) at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:114) at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:168) at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.jvm.kt:313) at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.jvm.kt:191) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:121) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:114) at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:2077) at android.view.View.dispatchAttachedToWindow(View.java:23105) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3520) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3527) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3527) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3527) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3527) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3527) at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:69) Copy stack to clipboard
a
Hi there, I'm sorry that you are encountering issues with the KMP plugin, we opened KMT-1769 to take a look at the issue, if you could provide other logs and information about your environment such as IDE and its version in the ticket, that would help us investigate the issue, thank you!
a
I created a simple project with this issue https://github.com/giuseppesorce/testmodulekmp preview for a button, icon with resource works in main module but doesn't work when i use a module
a
thank you for the repro steps, and do you encounter this in IntelliJ or Android Studio?
a
Android Studio
z
Debugged this in the meantime: it's yet another way that
com.android.kotlin.multiplatform.library
breaks previews. Using the older, regular Android library plugin solves the issue. I'll file an issue for Google.
a
yes, with android library i resolved issue