Getting below error when running the app for Ios(d...
# multiplatform
a
Getting below error when running the app for Ios(desktop and android working fine)
Copy code
> Task :data:kspKotlinIosSimulatorArm64
Failed to load native library:libjansi.jnilib. osinfo: Mac/arm64
java.lang.UnsatisfiedLinkError: /Users/atulgup/.gradle/native/jansi/1.18/osx/libjansi.jnilib: dlopen(/Users/atulgup/.gradle/native/jansi/1.18/osx/libjansi.jnilib, 0x0001): tried: '/Users/atulgup/.gradle/native/jansi/1.18/osx/libjansi.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/atulgup/.gradle/native/jansi/1.18/osx/libjansi.jnilib' (no such file), '/Users/atulgup/.gradle/native/jansi/1.18/osx/libjansi.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
note: [ksp] loaded provider(s): [androidx.room.RoomKspProcessor$Provider]
error: [ksp] java.lang.IllegalStateException: cannot find class kotlin.jvm.functions.Function1
More details in the đź§µ
data
kmm module contains room lib and has ksp compiler
The versions used are as follows
Copy code
kotlin = "2.0.0"
ksp = "2.0.0-1.0.21"

# android
agp = "8.4.1"

# room
room = "2.7.0-alpha03"
# See release notes from <https://developer.android.com/jetpack/androidx/releases/sqlite>
roomSqliteDriver = "2.5.0-alpha03"
build.gradle.kts setup
Copy code
plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.androidLibrary)
    alias(libs.plugins.ksp)
    alias(libs.plugins.room)
}

val kmmModuleName = "data"

kotlin {
    ...

    jvm("desktop${kmmModuleName.capitalizeUS()}")

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = kmmModuleName
            isStatic = true
        }
    }

    sourceSets {
        commonMain.dependencies {
            implementation(libs.bundles.room)
        }
        ...
    }
}

room {
    schemaDirectory("$projectDir/schemas")
    generateKotlin = true
}


dependencies {
    add("kspCommonMainMetadata", libs.room.compiler)
    add("kspAndroid", libs.room.compiler)
    add("kspDesktop${kmmModuleName.capitalizeUS()}", libs.room.compiler)
    add("kspIosSimulatorArm64", libs.room.compiler)
    add("kspIosX64", libs.room.compiler)
    add("kspIosArm64", libs.room.compiler)
}
m
Hopefully they look into this soon: https://issuetracker.google.com/345753562
u
any updates, if anyone is aware of ?
a
@Umesh Gupta attached issue is closed.. But my stack trace is different
u
I had the same issue and stack trace is same
Stuck here
I know there is some issue room configuration
But not able to figure out
Can you please share your gradle file ? It would be helpful
a
Attached in the original msg
Now the error is much shorter, like below
Copy code
> Task :data:kspKotlinIosSimulatorArm64 FAILED
note: [ksp] loaded provider(s): [androidx.room.RoomKspProcessor$Provider]
error: [ksp] java.lang.IllegalStateException: cannot find class kotlin.jvm.functions.Function1
	at androidx.room.compiler.processing.ksp.ResolverExtKt.requireClass(ResolverExt.kt:32)
	at androidx.room.compiler.processing.ksp.ResolverExtKt.requireType(ResolverExt.kt:34)
	at androidx.room.compiler.processing.ksp.KSTypeExtKt.replaceSuspendFunctionTypes(KSTypeExt.kt:41)
	at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.replaceSuspendFunctionTypes(KSTypeVarianceResolver.kt:126)
	at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.applyTypeVariance(KSTypeVarianceResolver.kt:67)
	at androidx.room.compiler.processing.ksp.KspProcessingEnv.resolveWildcards$room_compiler_processing(KspProcessingEnv.kt:343)
	at androidx.room.compiler.processing.ksp.KspType$xTypeName$2.invoke(KspType.kt:71)
	at androidx.room.compiler.processing.ksp.KspType$xTypeName$2.invoke(KspType.kt:69)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at androidx.room.compiler.processing.ksp.KspType.getXTypeName(KspType.kt:69)
b
is there any update on this issue? i am facing the same problem
a
I couldn’t solve this as of now
u
Find open interface in code base and remove open
b
i just deleted every open val and open sealed interface still getting this error:
Copy code
> Task :composeApp:kspKotlinIosSimulatorArm64
note: [ksp] loaded provider(s): [androidx.room.RoomKspProcessor$Provider]
error: [ksp] java.lang.IllegalStateException: cannot find class kotlin.jvm.functions.Function1
	at androidx.room.compiler.processing.ksp.ResolverExtKt.requireClass(ResolverExt.kt:32)
	at androidx.room.compiler.processing.ksp.ResolverExtKt.requireType(ResolverExt.kt:34)
	at androidx.room.compiler.processing.ksp.KSTypeExtKt.replaceSuspendFunctionTypes(KSTypeExt.kt:41)
	at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.replaceSuspendFunctionTypes(KSTypeVarianceResolver.kt:126)
	at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.applyTypeVariance(KSTypeVarianceResolver.kt:67)
	at androidx.room.compiler.processing.ksp.KspProcessingEnv.resolveWildcards$room_compiler_processing(KspProcessingEnv.kt:339)
	at androidx.room.compiler.processing.ksp.KspType$xTypeName$2.invoke(KspType.kt:71)
	at androidx.room.compiler.processing.ksp.KspType$xTypeName$2.invoke(KspType.kt:69)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:83)
	at androidx.room.compiler.processing.ksp.KspType.getXTypeName(KspType.kt:69)
	at androidx.room.compiler.processing.ksp.KspType.asTypeName(KspType.kt:63)
	at androidx.room.compiler.processing.MethodSpecHelper.overriding(JavaPoetExt.kt:182)
	at androidx.room.compiler.processing.MethodSpecHelper.overridingWithFinalParams(JavaPoetExt.kt:148)
	at androidx.room.compiler.codegen.XFunSpec$Companion.overridingBuilder(XFunSpec.kt:166)
	at androidx.room.compiler.codegen.XFunSpec$Companion.overridingBuilder$default(XFunSpec.kt:158)
	at androidx.room.writer.DaoWriter.overrideWithoutAnnotations(DaoWriter.kt:751)
	at androidx.room.writer.DaoWriter.createDefaultImplMethodDelegate(DaoWriter.kt:717)
	at androidx.room.writer.DaoWriter.access$createDefaultImplMethodDelegate(DaoWriter.kt:73)
	at androidx.room.writer.DaoWriter$createTypeSpecBuilder$1$5.invoke(DaoWriter.kt:162)
	at androidx.room.writer.DaoWriter$createTypeSpecBuilder$1$5.invoke(DaoWriter.kt:160)
	at androidx.room.compiler.codegen.XTypeSpec$Builder$Companion$applyTo$2.invoke(XTypeSpec.kt:90)
	at androidx.room.compiler.codegen.XTypeSpec$Builder$Companion$applyTo$2.invoke(XTypeSpec.kt:88)
	at androidx.room.compiler.codegen.XTypeSpec$Builder$Companion.applyTo(XTypeSpec.kt:79)
	at androidx.room.compiler.codegen.XTypeSpec$Builder$Companion.applyTo(XTypeSpec.kt:88)
	at androidx.room.writer.DaoWriter.createTypeSpecBuilder(DaoWriter.kt:160)