Hello there :slightly_smiling_face: I have just st...
# multiplatform
c
Hello there 🙂 I have just started with android and multiplatform. I have the problem, that in my gradle skripts "androidx.room:room-runtime" could not be resolved. I need them to run a local database. What am I doing wrong?
Copy code
plugins {
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.kotlinAndroid)
    alias(libs.plugins.compose.compiler)
}

val room_version : String by project

android {

    sourceSets {
        repositories {
            google()
            mavenCentral()
        }
        dependencies {
            implementation(libs.compose.ui)
            implementation(libs.compose.ui.tooling.preview)
            implementation(libs.compose.material3)
            implementation(libs.androidx.activity.compose)
            runtimeOnly("androidx.room:room-runtime:$room_version")
            annotationProcessor("androidx.room:room-compiler:$room_version")
            debugImplementation(libs.compose.ui.tooling)
        }
    }

    namespace = "com.chris576.diary.android"
    compileSdk = 34
    defaultConfig {
        applicationId = "com.chris576.diary.android"
        minSdk = 29
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"
    }
    buildFeatures {
        compose = true
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
c
That’s not how your setup Android in a Multiplatform environment. Have a look at the sample projects: https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-samples.html
l
If you want to generate a MultiPlatform project you should : 1. go to website https://kmp.jetbrains.com/ and choose your options 2. generate the zip, download it and extract it, and import it into your IDE 3. then you can add android dependencies in the androidMain.dependencies, or add them in commonMain.dependencies if it can target all platforms