Chaintech-Network / QRKitComposeMultiplatform

Apache License 2.0
182 stars 13 forks source link

Error No instrumentation registered! Must run under a registering instrumentation - Android simulator #18

Closed santyas closed 1 month ago

santyas commented 1 month ago

Updated to 3.0.1 but cannot test on android simulator: Captura de pantalla 2024-10-15 a la(s) 16 03 44

2024-10-15 15:59:26.825 7098-7098 AndroidRuntime com.my.app E FATAL EXCEPTION: main (Ask Gemini) Process: com.my.app, PID: 7098 java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation. at androidx.test.platform.app.InstrumentationRegistry.getInstrumentation(InstrumentationRegistry.java:45) at org.jetbrains.compose.resources.AndroidContextProviderKt.getAndroidInstrumentedContext(AndroidContextProvider.kt:16) at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.getInstrumentedAssets(ResourceReader.android.kt:22) at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.getResourceAsStream(ResourceReader.android.kt:79) at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.readPart(ResourceReader.android.kt:34) at org.jetbrains.compose.resources.StringResourcesUtilsKt$getStringItem$2.invokeSuspend(StringResourcesUtils.kt:30) at org.jetbrains.compose.resources.StringResourcesUtilsKt$getStringItem$2.invoke(Unknown Source:8) at org.jetbrains.compose.resources.StringResourcesUtilsKt$getStringItem$2.invoke(Unknown Source:2) at org.jetbrains.compose.resources.AsyncCache$getOrLoad$2$deferred$1$1.invokeSuspend(AsyncCache.kt:19) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1) at org.jetbrains.compose.resources.ResourceState_blockingKt.rememberResourceState(ResourceState.blocking.kt:15) at org.jetbrains.compose.resources.StringResourcesKt.stringResource(StringResources.kt:27) at com.my.app.routes.ComposableSingletons$ScaffoldAppKt$lambda-1$1.invoke(ScaffoldApp.kt:80) at com.my.app.routes.ComposableSingletons$ScaffoldAppKt$lambda-1$1.invoke(ScaffoldApp.kt:80) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380) at androidx.compose.material3.internal.ProvideContentColorTextStyleKt.ProvideContentColorTextStyle-3J-VO9M(ProvideContentColorTextStyle.kt:41) at androidx.compose.material3.AppBarKt.TopAppBarLayout-kXwM9vE(AppBar.kt:2150) at androidx.compose.material3.AppBarKt.access$TopAppBarLayout-kXwM9vE(AppBar.kt:1) at androidx.compose.material3.AppBarKt$SingleRowTopAppBar$3.invoke(AppBar.kt:1928) at androidx.compose.material3.AppBarKt$SingleRowTopAppBar$3.invoke(AppBar.kt:1927) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:126) at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:108) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380) at androidx.compose.material3.SurfaceKt.Surface-T9BRK9s(Surface.kt:105) at androidx.compose.material3.AppBarKt.SingleRowTopAppBar-cJHQLPU(AppBar.kt:1927) at androidx.compose.material3.AppBarKt.CenterAlignedTopAppBar-GHTll3U(AppBar.kt:333) at com.my.app.routes.ScaffoldAppKt$ScaffoldApp$1.invoke(ScaffoldApp.kt:56) 2024-10-15 15:59:26.826 7098-7098 AndroidRuntime com.my.app E at com.my.app.routes.ScaffoldAppKt$ScaffoldApp$1.invoke(ScaffoldApp.kt:55) (Ask Gemini) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:1017) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:493) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:97) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3595) at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3522) at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:743) at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1122) at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3876) at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:649) at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:635) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:516) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:488) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:479) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:463) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:895) at androidx.compose.material3.ScaffoldKt$ScaffoldLayout$1$1.invoke-0kLqBqw(Scaffold.kt:147) at androidx.compose.material3.ScaffoldKt$ScaffoldLayout$1$1.invoke(Scaffold.kt:140) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:725) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315) at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:503) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133) at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1775) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:40) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:696) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:672) at androidx.compose.foundation.layout.BoxMeasurePolicy.measure-3p2s80s(Box.kt:151) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135) at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188) 2024-10-15 15:59:26.826 7098-7098 AndroidRuntime com.my.app E at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316) (Ask Gemini) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315) at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:503) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133) at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1775) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:40) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:696) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:672) at androidx.compose.ui.layout.RootMeasurePolicy.measure-3p2s80s(RootMeasurePolicy.kt:38) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315) at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2441) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133) at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1775) at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:40) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:696) at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(LayoutNode.kt:1222) at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:367) at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureOnly(MeasureAndLayoutDelegate.kt:622) at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureOnly(MeasureAndLayoutDelegate.kt:420) at androidx.compose.ui.platform.AndroidComposeView.onMeasure(AndroidComposeView.android.kt:1375) at android.view.View.measure(View.java:26357) at androidx.compose.ui.platform.AbstractComposeView.internalOnMeasure$ui_release(ComposeView.android.kt:309) at androidx.compose.ui.platform.AbstractComposeView.onMeasure(ComposeView.android.kt:296) at android.view.View.measure(View.java:26357) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:26357) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:26357) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) 2024-10-15 15:59:26.826 7098-7098 AndroidRuntime com.my.app E at com.android.internal.policy.DecorView.onMeasure(DecorView.java:760) (Ask Gemini) at android.view.View.measure(View.java:26357) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3926) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2612) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2884) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2328) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9087) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239) at android.view.Choreographer.doCallbacks(Choreographer.java:899) at android.view.Choreographer.doFrame(Choreographer.java:832) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

My gradle: https://gist.github.com/santyas/5a79f1d997a571c3ebfb8d0354c8ffee

Thank you!

pAlkesz commented 1 month ago

I am facing the same issue on a real device

mayur-ctn commented 1 month ago

@santyas @pAlkesz Try upgrading the compose version to 1.7.0-rc01.

santyas commented 1 month ago

Solved. I had to update some dependency versions.

JirkaKrivanek commented 1 month ago

The 3.0.2 version is mentioned in README, but if I update to it, I cannot download it. How can we get this fix (apart of building ourselves)?

santyas commented 1 month ago

Did you see any console errors? Could you share your gradle config?

JirkaKrivanek commented 1 month ago

LogCat:

                                                                                                    Process: com.blazek.sport, PID: 16010
                                                                                                    java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation.
                                                                                                        at androidx.test.platform.app.InstrumentationRegistry.getInstrumentation(InstrumentationRegistry.java:45)
                                                                                                        at org.jetbrains.compose.resources.AndroidContextProviderKt.getAndroidInstrumentedContext(AndroidContextProvider.kt:16)
                                                                                                        at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.getInstrumentedAssets(ResourceReader.android.kt:22)
                                                                                                        at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.getResourceAsStream(ResourceReader.android.kt:79)
                                                                                                        at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.readPart(ResourceReader.android.kt:34)
                                                                                                        at org.jetbrains.compose.resources.StringResourcesUtilsKt$getStringItem$2.invokeSuspend(StringResourcesUtils.kt:30)
                                                                                                        at org.jetbrains.compose.resources.StringResourcesUtilsKt$getStringItem$2.invoke(Unknown Source:8)
                                                                                                        at org.jetbrains.compose.resources.StringResourcesUtilsKt$getStringItem$2.invoke(Unknown Source:2)
                                                                                                        at org.jetbrains.compose.resources.AsyncCache$getOrLoad$2$deferred$1$1.invokeSuspend(AsyncCache.kt:19)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
                                                                                                        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
                                                                                                        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
                                                                                                        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
                                                                                                        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
                                                                                                        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
                                                                                                        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
                                                                                                        at org.jetbrains.compose.resources.ResourceState_blockingKt.rememberResourceState(ResourceState.blocking.kt:15)
                                                                                                        at org.jetbrains.compose.resources.StringResourcesKt.stringResource(StringResources.kt:27)
                                                                                                        at com.blazek.sport.ui.views.ProgressesKt.ProgressHorizontal(Progresses.kt:46)
                                                                                                        at com.blazek.sport.ui.screens.splash.SplashScreenKt.Content(SplashScreen.kt:65)
                                                                                                        at com.blazek.sport.ui.screens.splash.SplashScreenKt.access$Content(SplashScreen.kt:1)
                                                                                                        at com.blazek.sport.ui.screens.splash.SplashScreenImpl.content$composeApp_debug(SplashScreen.kt:48)
                                                                                                        at com.blazek.sport.ui.navigator.NavigatorImpl$root$3.invoke(Navigator.kt:101)
                                                                                                        at com.blazek.sport.ui.navigator.NavigatorImpl$root$3.invoke(Navigator.kt:100)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                        at androidx.compose.animation.AnimatedVisibilityKt.AnimatedEnterExitImpl(AnimatedVisibility.kt:771)
                                                                                                        at androidx.compose.animation.AnimatedVisibilityKt$AnimatedEnterExitImpl$4.invoke(Unknown Source:27)
                                                                                                        at androidx.compose.animation.AnimatedVisibilityKt$AnimatedEnterExitImpl$4.invoke(Unknown Source:10)
                                                                                                        at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
                                                                                                        at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2825)
                                                                                                        at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:3139)
                                                                                                        at androidx.compose.animation.AnimatedVisibilityKt.AnimatedVisibilityImpl(AnimatedVisibility.kt:715)
                                                                                                        at androidx.compose.animation.AnimatedVisibilityKt.AnimatedVisibility(AnimatedVisibility.kt:387)
                                                                                                        at com.blazek.sport.ui.navigator.NavigatorImpl.root(Navigator.kt:96)
                                                                                                        at com.blazek.sport.ui.navigator.NavigatorImpl.root$lambda$6(Unknown Source:6)
                                                                                                        at com.blazek.sport.ui.navigator.NavigatorImpl.$r8$lambda$ziacU0cK9GFwpWX8UB7H29zmEFQ(Unknown Source:0)
                                                                                                        at com.blazek.sport.ui.navigator.NavigatorImpl$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)
                                                                                                        at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
                                                                                                        at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2825)
2024-10-20 16:38:53.295 16010-16010 AndroidRuntime          com.blazek.sport                     E      at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3116)
                                                                                                        at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3607)
                                                                                                        at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3552)
                                                                                                        at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:948)
                                                                                                        at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1206)
                                                                                                        at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:132)
                                                                                                        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:616)
                                                                                                        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:585)
                                                                                                        at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
                                                                                                        at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
                                                                                                        at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
                                                                                                        at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
                                                                                                        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
                                                                                                        at android.view.Choreographer.doCallbacks(Choreographer.java:845)
                                                                                                        at android.view.Choreographer.doFrame(Choreographer.java:775)
                                                                                                        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:938)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                        at android.os.Looper.loop(Looper.java:288)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7870)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
                                                                                                        Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@58d7a85, androidx.compose.ui.platform.MotionDurationScaleImpl@6fe0da, StandaloneCoroutine{Cancelling}@8c1590b, AndroidUiDispatcher@cf673e8]
JirkaKrivanek commented 1 month ago

Console:

2024-10-20 16:38:54: Launching Android App on 'Pixel_3a_API_32_arm64-v8a'.
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.blazek.sport/.MainActivity }

Open logcat panel for emulator Pixel 3a API 32 arm64-v8a
Connected to process 16010 on device 'Pixel_3a_API_32_arm64-v8a [emulator-5554]'.
JirkaKrivanek commented 1 month ago

Build.gradle.kts:

import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsCompose)
    alias(libs.plugins.compose.compiler)
    alias(libs.plugins.kotlinx.serialization)
    alias(libs.plugins.ksp)
}

kotlin {
    androidTarget {
        @OptIn(ExperimentalKotlinGradlePluginApi::class)
        compilerOptions {
            jvmTarget.set(JvmTarget.JVM_11)
        }
    }

    jvm("desktop")

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            baseName = "ComposeApp"
            isStatic = true
        }
    }

    sourceSets {
        val desktopMain by getting

        commonMain.dependencies {
            implementation(libs.kotlinx.coroutines.core)
            implementation(libs.kotlinx.date.time)
            implementation(libs.kotlinx.date.time.ext)
            implementation(libs.kotlinx.serialization)

            implementation(libs.kotlinx.inject.runtime)

            implementation(libs.kotlinx.ktor.core)
            implementation(libs.kotlinx.ktor.cio)

            implementation(libs.qr.kit)
            implementation("io.github.kevinnzou:compose-webview-multiplatform:1.9.40-alpha03")

            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.material3)
            implementation(compose.materialIconsExtended)
            implementation(compose.ui)
            implementation(compose.components.resources)
            implementation(compose.components.uiToolingPreview)
        }

        commonTest.dependencies {
            implementation(libs.kotlinx.test)
            implementation(libs.kotlinx.kotest)
            implementation(libs.kotlinx.coroutines.test)
        }

        androidMain.dependencies {
            implementation(compose.preview)
            implementation(libs.androidx.activity.compose)
        }

        desktopMain.dependencies {
            implementation(compose.desktop.currentOs)
            implementation(libs.kotlinx.coroutines.swing)
        }

        iosMain.dependencies {
            implementation(libs.kotlinx.ktor.darwin)
        }
    }

    configureCommonMainKsp()
}

android {
    namespace = "com.blazek.sport"
    compileSdk = libs.versions.android.compileSdk.get().toInt()

    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    sourceSets["main"].res.srcDirs("src/androidMain/res")
    sourceSets["main"].resources.srcDirs("src/commonMain/resources")

    defaultConfig {
        applicationId = "com.blazek.sport"
        minSdk = libs.versions.android.minSdk.get().toInt()
        targetSdk = libs.versions.android.targetSdk.get().toInt()
        versionCode = 1
        versionName = "1.0"
    }

    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }

    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }

    buildFeatures {
        compose = true
    }

    dependencies {
        debugImplementation(compose.uiTooling)
        implementation(libs.kotlinx.ktor.okhttp)
    }
}

compose.desktop {
    application {
        mainClass = "com.blazek.sport.MainKt"

        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "com.blazek.sport"
            packageVersion = "1.0.0"
        }

        // For WebView
        jvmArgs("--add-opens", "java.desktop/sun.awt=ALL-UNNAMED")
        jvmArgs("--add-opens", "java.desktop/java.awt.peer=ALL-UNNAMED") // recommended but not necessary
        if (System.getProperty("os.name").contains("Mac")) {
            jvmArgs("--add-opens", "java.desktop/sun.lwawt=ALL-UNNAMED")
            jvmArgs("--add-opens", "java.desktop/sun.lwawt.macosx=ALL-UNNAMED")
        }
    }
}

dependencies {
//    kspCommonMainMetadata(libs.kotlinx.inject.compiler)
    add("kspCommonMainMetadata", libs.kotlinx.inject.compiler)
//    add("kspDesktop", libs.kotlinx.inject.compiler)
//    add("kspAndroid", libs.kotlinx.inject.compiler)
//    add("kspIosX64", libs.kotlinx.inject.compiler)
//    add("kspIosArm64", libs.kotlinx.inject.compiler)
//    add("kspIosSimulatorArm64", libs.kotlinx.inject.compiler)
}

fun KotlinMultiplatformExtension.configureCommonMainKsp() {
    sourceSets.named("commonMain").configure {
        kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
    }

    project.tasks.withType(KotlinCompilationTask::class.java).configureEach {
        if (name != "kspCommonMainKotlinMetadata") {
            dependsOn("kspCommonMainKotlinMetadata")
        }
    }
}
JirkaKrivanek commented 1 month ago

Toml:

qr-kit = "3.0.1"
qr-kit = { module = "network.chaintech:qr-kit", version.ref = "qr-kit" }

If I update to 3.0.2 then I get error resolving dependency...