3

Im following the template provided here by Jetbrains for adding compose to iOS and android and facing following issue:

FAILURE: Build completed with 4 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':kmm:shared:compileCommonMainKotlinMetadata'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Internal compiler error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':kmm:shared:linkDebugFrameworkIosArm64'.
> Compilation finished with errors

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':kmm:shared:linkDebugFrameworkIosX64'.
> Compilation finished with errors

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':kmm:shared:linkDebugFrameworkIosSimulatorArm64'.
> Compilation finished with errors

I have added maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") in my repositories and having following configuration:

composeVersion="1.4.0"
agp="7.4.2"
kotlin="1.8.20"
kotlinCompilerExtensionVersion = "1.4.6"

Inside shared/build.gradle.kts

kotlin {
  ....
  sourceSets{
    val commonMain by getting{
       dependencies {
         ...
         implementation(compose.runtime)
         implementation(compose.foundation)
         implementation(compose.material)            
         @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
         implementation(compose.components.resources)
       }
       ....
    }
    ....
  }
  .....
}

Is there anything else apart from this I need to configure for using compose in iOS and Android.

  • 1
    I added isStatic = true inside `framework` config and is able to build the app now but as I added composable in shared Im getting following error now: ``` Showing Recent Messages Undefined symbol: _kfun:com.arindom.cocompose#GreetingView(){} Linker command failed with exit code 1 (use -v to see invocation). ``` – arindom ghosh May 05 '23 at 12:55
  • I have same error. Please write comment if you resolved this error! – alezhka May 09 '23 at 09:07
  • 1
    This solution fixed the issue https://github.com/JetBrains/compose-multiplatform/issues/3126#issuecomment-1536530975 – arindom ghosh May 25 '23 at 05:49

0 Answers0