Linus Närkling
05/29/2024, 7:28 AMlibs.versions.toml
file like so:
[versions]
indexeddb = "0.7.1"
[libraries]
indexeddb = { group = "com.juul.indexeddb", name = "core", version.ref = "indexeddb" }
So first I'm unsure if the dependency should be defined in shared/build.gradle.kts
or composeApp/build.gradle.kts
. I think the latter, but I've tried both.
For shared/build.gradle.kts
, I've added this under `kotlin > sourceSets`:
sourceSets {
commonMain.dependencies {
// put your Multiplatform dependencies here
}
wasmJsMain.dependencies {
implementation(libs.indexeddb)
}
}
Full file: https://gist.github.com/VapidLinus/efb65c7ed1311a3af066b6d8f0d763b4
And for composeApp/build.gradle.kts
I've added this under `kotlin > sourceSets`:
sourceSets {
val desktopMain by getting
androidMain.dependencies {
...
}
commonMain.dependencies {
...
}
desktopMain.dependencies {
implementation(compose.desktop.currentOs)
}
wasmJsMain.dependencies {
implementation(libs.indexeddb)
}
}
Full file: https://gist.github.com/VapidLinus/0a4efe8588af8f7fbf2b8faf837522d4
Then I do a Gradle sync and expect the dependency should work, but it seems not. To test I have a file composeApp/src/wasmJsMain/kotlin/App.wasmJs.kt
where I try to open a database:
import kotlin.random.Random
import com.juul.indexeddb.openDatabase
actual fun databaseTest() {
val database = openDatabase("test.db", 1)
}
But I get the errors:
Unresolved reference: com :3
Unresolved reference: openDatabase: 5
If I look under "External Libraries" in the Project window in Android Studio I do not see com.juul.indexeddb
listed so I think the dependency isn't getting added.
I've also tried replacing implementation(libs.indexeddb)
with implementation("com.juul.indexeddb:core:0.7.1")
just in case it is a config issue, but that does not help either.
Does anyone have any advice or know what I'm doing wrong to add indexeddb as a dependency to my wasm module? Much appreciatedtravis
05/29/2024, 5:11 PMtravis
05/29/2024, 5:22 PMLinus Närkling
05/29/2024, 5:32 PM