# multiplatform


02/28/2024, 1:52 PM
Hello everyone, i’m facing an issue while creating archive from xcode for testflight, however it working fine on simulators and physical ios devices… please let me know what could cause this issue? thank you!!!
Copy code
Type-safe project accessors is an incubating feature.
> Task :xcodeVersion UP-TO-DATE
> Task :composeApp:checkKotlinGradlePluginConfigurationErrors
> Task :composeApp:compileKotlinIosArm64 UP-TO-DATE
> Task :composeApp:linkReleaseFrameworkIosArm64
error: Compilation failed: Index 0 out of bounds for length 0

 * Source files: 
 * Compiler version: 1.9.21
 * Output kind: FRAMEWORK

error: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(
	at java.base/jdk.internal.util.Preconditions.checkIndex(
	at java.base/java.util.Objects.checkIndex(
	at java.base/java.util.ArrayList.get(
	at org.jetbrains.kotlin.backend.konan.optimizations.StaticInitializersOptimization$InterproceduralAnalysis.getCalledInitializer(StaticInitializersOptimization.kt:246)
	at org.jetbrains.kotlin.backend.konan.optimizations.StaticInitializersOptimization$InterproceduralAnalysis.analyze(StaticInitializersOptimization.kt:120)
	at ..............

> Task :composeApp:linkReleaseFrameworkIosArm64 FAILED
error: Compilation finished with errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':composeApp:linkReleaseFrameworkIosArm64'.
> Compilation finished with errors
👀 1

Joel Denke

02/28/2024, 1:59 PM
I have the same issue, however only when launch iOS from Android Studio, but works in XCode or Fleet to launch/build. Curious to hear more about this. Sorry I cant help, just tried to fix it myself but without luck.


02/28/2024, 10:23 PM
seems like it’s an kotlin issue, i was using circuit so find an already reported issue for it. issue track : Solved the issue by using this code snippet.
Copy code
kotlin.targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
    binaries.all {
        freeCompilerArgs += "-Xdisable-phases=RemoveRedundantCallsToStaticInitializersPhase"
gratitude thank you 1
🎉 1

Joel Denke

02/29/2024, 7:05 AM
Nice, glad to hear you found a solution! :)