MDev25
MDev25

Reputation: 246

How to fix jetpack compose compiler error?

Project does not build because of compose compiler error. Adding "androidx.compose.compiler:compiler" dependency does not fix error.

App build.gradle.kts file:

val compose_version = "1.0.0-beta09"

dependencies {
    implementation(project(":mpp-library"))
    implementation("androidx.activity:activity-compose:1.3.0-beta02")
    implementation("androidx.compose.ui:ui:${compose_version}")
    implementation("androidx.compose.foundation:foundation:1.0.0-beta09")
    implementation("androidx.compose.material:material:1.0.0-beta09")
    implementation("androidx.compose.material:material-icons-core:1.0.0-beta09")
    implementation("androidx.compose.material:material-icons-extended:${compose_version}")
    implementation("androidx.compose.ui:ui-tooling:$compose_version")
    implementation("androidx.compose.compiler:compiler:1.0.0-beta09")
}

 multiplatformUnits {
    classesPackage = "com.test.app"
    dataBindingPackage = "com.test.app"
    layoutsSourceSet = "main"
 }

 android {
    compileSdkVersion(30)
    defaultConfig {
        applicationId = "com.test.app"
        minSdkVersion(21)
        targetSdkVersion(30)
        versionCode = 1
        versionName = "1.0"
    }
    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }

    buildFeatures {
        compose = true
        viewBinding = true
    }

    packagingOptions {
        exclude("META-INF/*.kotlin_module")
    }

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

    kotlinOptions {
       jvmTarget = "1.8"
    }

    composeOptions {
        kotlinCompilerExtensionVersion = compose_version
    }
 }

Code does not compile because of error even compose compiler dependency added:

Execution failed for task ':android-app:prepareDebugKotlinCompileTask'. > Could not resolve all files for configuration ':android-app:kotlin-extension'. > Could not find androidx.compose:compose-compiler:1.0.0-beta09.

Searched in the following locations:

- https://repo.maven.apache.org/maven2/androidx/compose/compose-compiler/1.0.0-beta09/compose-compiler-1.0.0-beta09.pom
       - https://dl.google.com/dl/android/maven2/androidx/compose/compose-compiler/1.0.0-beta09/compose-compiler-1.0.0-beta09.pom
       - https://jcenter.bintray.com/androidx/compose/compose-compiler/1.0.0-beta09/compose-compiler-1.0.0-beta09.pom
     Required by:
         project :android-app

How to fix this error?

Upvotes: 1

Views: 2401

Answers (1)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

Could not resolve all files for configuration ':android-app:kotlin-extension'. Could not find androidx.compose:compose-compiler:1.0.0-beta09.

Don't androidx.compose:compose-compiler

Do androidx.compose.compiler:compiler

You should use

 implementation("androidx.compose.compiler:compiler:1.0.0-beta09")

Upvotes: 3

Related Questions