Abanoub Samir
Abanoub Samir

Reputation: 517

CMP sync issue with Room & SQLite :composeApp:wasmJsMain: Could not resolve androidx.room:room-runtime:2.7.0-beta01

I am adding room and sqlite-bundled to a compose multiplatform app, now I am getting this issue when syncing the project:

:composeApp:wasmJsMain: Could not resolve androidx.room:room-runtime:2.7.0-beta01.
Required by:
    project :composeApp

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

:composeApp:wasmJsMain: Could not resolve androidx.sqlite:sqlite-bundled:2.5.0-beta01.
Required by:
    project :composeApp

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

:composeApp:wasmJsTest: Could not resolve androidx.room:room-runtime:2.7.0-beta01.
Required by:
    project :composeApp

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

:composeApp:wasmJsTest: Could not resolve androidx.sqlite:sqlite-bundled:2.5.0-beta01.
Required by:
    project :composeApp

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Versions that I am use:

sqlite = "2.5.0-beta01"
room = "2.7.0-beta01"

I am already have mavenCentral and google artifacts in the settings.gradle.kts:

pluginManagement {
    repositories {
        google {
            mavenContent {
                includeGroupAndSubgroups("androidx")
                includeGroupAndSubgroups("com.android")
                includeGroupAndSubgroups("com.google")
            }
        }
        mavenCentral()
        gradlePluginPortal()
    }
}

dependencyResolutionManagement {
    repositories {
        google {
            mavenContent {
                includeGroupAndSubgroups("androidx")
                includeGroupAndSubgroups("com.android")
                includeGroupAndSubgroups("com.google")
            }
        }
        mavenCentral()
    }
}

Gradle build files:

build.gradle.kts (project):

plugins {
    ...
    alias(libs.plugins.ksp) apply false
    alias(libs.plugins.room) apply false
}

build.gradle.kts (composeApp):

plugins {
    ...
    alias(libs.plugins.ksp)
    alias(libs.plugins.room)
}


kotlin {
    androidTarget {
        @OptIn(ExperimentalKotlinGradlePluginApi::class)
        compilerOptions {
            jvmTarget.set(JvmTarget.JVM_11)
        }
    }

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            baseName = "ComposeApp"
            isStatic = true
        }
    }

    jvm("desktop")

    @OptIn(ExperimentalWasmDsl::class)
    wasmJs {
        ...
    }

    room {
        schemaDirectory("$projectDir/schemas")
    }

    sourceSets {
        val desktopMain by getting

        androidMain.dependencies {
            ...
        }
        commonMain.dependencies {
            ...
            implementation(libs.androidx.room.runtime)
            implementation(libs.sqlite.bundled)
        }
        desktopMain.dependencies {
            ...
        }

        nativeMain.dependencies {
            ...
        }

        wasmJsMain.dependencies {
            ...
        }

        dependencies {
            ksp(libs.androidx.room.compiler)
        }
    }
}

Since these is the last room & sqlite versions that supports KMP, I have tried to downgrade the versions but still gotting the issue.

Upvotes: 1

Views: 39

Answers (0)

Related Questions