I still didn’t find a solution to this, my `androi...
# multiplatform
r
I still didn’t find a solution to this, my
android
target has no
compilation
r
Just a guess but try adding
google()
to your
repositories
block instead of just
jcenter()
.
r
Yep I added it because it didn’t even build, but it still doesn’t fix the problem. It looks like I have no variants at all
My current `build.gradle.kts`:
Copy code
repositories {
    google()
    jcenter()
}

plugins {
    id("com.android.application") version "3.3.0"
    kotlin("multiplatform") version "1.3.20"
}

android {

    compileSdkVersion(28)

    defaultConfig {
        minSdkVersion(19)
        targetSdkVersion(28)
    }

    sourceSets {
        val main by getting {
            java.setSrcDirs(listOf("src/androidMain/kotlin"))
            manifest.srcFile("src/androidMain/AndroidManifest.xml")
        }
        val test by getting {
            java.setSrcDirs(listOf("src/androidTest/kotlin"))
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    buildTypes {
        val release by getting {
            isMinifyEnabled = true
            isShrinkResources = true
        }
        val debug by getting {
            isDebuggable = true
            isTestCoverageEnabled = true
        }
    }

    println(android.applicationVariants)

}

kotlin {

    android {
        println(compilations.asMap)
    }

    iosArm64 {
        println(compilations.asMap)
    }

    iosX64 {
        println(compilations.asMap)
    }

    sourceSets {

        val commonMain by getting
        val commonTest by getting
        val androidMain by getting
        val androidTest by getting
        val iosMain by creating
        val iosTest by creating

    }

}
The first two
println
print
[]
and
{}
h
@ribesg As the Android Gradle plugin only creates the variants after the project is evaluated, the Kotlin compilations appear no sooner than that. To access them, you can use
afterEvaluate { ... }
.
r
Yeah that validates my theory that the longer time you spend trying to find the solution to a problem, the greater are the chance that there was no problem in the first place... Thanks!