Hello, Been trying to begin building out the andro...
# multiplatform
a
Hello, Been trying to begin building out the android version of a multiplatform project, but I'm getting an exception from Gradle during android build:
Copy code
org.gradle.api.CircularReferenceException: Circular dependency between the following tasks:
:composeApp:processDebugResources
\--- :composeApp:processDebugResources (*)
It seems to be suggesting that the debug resources in android are dependent on themselves, but I cannot work out why, I have done very little to the build file, and the desktop build works just as expected, Gradle file in thread as to not take up space
Copy code
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsCompose)
    alias(libs.plugins.compose.compiler)
}

kotlin {
    androidTarget {
        @OptIn(ExperimentalKotlinGradlePluginApi::class)
        compilerOptions {
            jvmTarget.set(JvmTarget.JVM_11)
        }
    }
    
    jvm("desktop")
    
    sourceSets {
        val desktopMain by getting
        
        androidMain.dependencies {
            implementation(compose.preview)
            implementation(libs.androidx.activity.compose)
        }
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.material)
            implementation(compose.ui)
            implementation(compose.components.resources)
            implementation(compose.components.uiToolingPreview)
            implementation(libs.androidx.lifecycle.viewmodel)
            implementation(libs.androidx.lifecycle.runtime.compose)
            implementation(libs.kotlinx.serialization.json)
        }
        desktopMain.dependencies {
            implementation(compose.desktop.currentOs)
            implementation(libs.kotlinx.coroutines.swing)
        }
    }
}

android {
    namespace = "com.blah.bleh"
    compileSdk = libs.versions.android.compileSdk.get().toInt()

    //tried removing these, error persisted
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    sourceSets["main"].res.srcDirs("src/androidMain/res")
    sourceSets["main"].resources.srcDirs("src/commonMain/resources")

    defaultConfig {
        applicationId = "com.blah.bleh"
        minSdk = libs.versions.android.minSdk.get().toInt()
        targetSdk = libs.versions.android.targetSdk.get().toInt()
        versionCode = 1
        versionName = "1.0"
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    buildFeatures {
        compose = true
    }
    dependencies {
        debugImplementation(compose.uiTooling)
    }
}
dependencies {
    implementation(project(":composeApp"))
}

compose.desktop {
    application {
        mainClass = "com.blah.bleh.MainKt"

        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "com.blah.bleh"
            packageVersion = "1.0.0"

            appResourcesRootDir.set(project.layout.projectDirectory.dir("src/desktopMain/resources"))
        }
    }
}
a
Is there any error info about the CircularReference packages?
a
Unfortunately not, generally the exception would provide a handy little chart, but in this case its just pointing to itself. The stack trace doesn't have much of use either, it's all internal. only other warning is that It's using deprecated features that make it incompatible with Gradle 9.0, but it always does that on the blank project templates
j
could be coming from one of your dependencies...I'd try to remove all the dependencies, then add em back one by one until you figure out which one causes it.