https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
s

Slackbot

11/30/2023, 2:43 PM
This message was deleted.
h

hfhbd

11/30/2023, 4:19 PM
You have to rename your expect/actual file in commonMain or androdMain, eg SqlDriverFactory-Android.kt
🙌 1
r

Romão

11/30/2023, 5:10 PM
Many thanks @hfhbd it solves. This issue/resolution is different to understand the rational, mixing the name of the file with the content of it. Able to give one more baby step, now facing the following error message, which also doesn't makes much sense E FATAL EXCEPTION: main Process: com.jetbrains.kmpapp, PID: 2421 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:502) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: org.koin.android.error.MissingAndroidContextException: Can't resolve Context instance. Please use androidContext() function in your KoinApplication configuration. at org.koin.android.ext.koin.ModuleExtKt.androidContext(ModuleExt.kt:33) at com.jetbrains.kmpapp.data.AndroidSqlDriverFactoryKt.sqlDriverFactory(AndroidSqlDriverFactory.kt:11) at com.jetbrains.kmpapp.di.KoinKt$databaseModule$1$1.invoke(Koin.kt:47) at com.jetbrains.kmpapp.di.KoinKt$databaseModule$1$1.invoke(Koin.kt:47) at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:50) at org.koin.core.instance.FactoryInstanceFactory.get(FactoryInstanceFactory.kt:38) at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:116) at org.koin.core.scope.Scope.resolveValue(Scope.kt:247) at org.koin.core.scope.Scope.resolveInstance(Scope.kt:233) at org.koin.core.scope.Scope.get(Scope.kt:212) at com.jetbrains.kmpapp.di.KoinKt$databaseModule$1$2.invoke(Koin.kt:73) at com.jetbrains.kmpapp.di.KoinKt$databaseModule$1$2.invoke(Koin.kt:48) at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:50) at org.koin.core.instance.SingleInstanceFactory.create(SingleInstanceFactory.kt:46) when i do have androidContext()
Copy code
actual fun Scope.sqlDriverFactory(): SqlDriver {

    return AndroidSqliteDriver(QuestionsDatabase.Schema, androidContext(), "questions.db")
}
h

hfhbd

11/30/2023, 5:17 PM
Sorry, I don’t know koin.
3 Views