Could not find androidx.compose.compiler:compiler:1.2.1

Viewed 94

Getting the following error when creating a new Compose Project in Android Studio and updating to the suggested compose version of 1.2.1:

Execution failed for task ':app:compileDebugKotlin'.

Could not resolve all files for configuration ':app:kotlin-extension'. Could not find androidx.compose.compiler:compiler:1.2.1. Searched in the following locations: - https://dl.google.com/dl/android/maven2/androidx/compose/compiler/compiler/1.2.1/compiler-1.2.1.pom - https://repo.maven.apache.org/maven2/androidx/compose/compiler/compiler/1.2.1/compiler-1.2.1.pom Required by: project :app

2 Answers

I had to go to compose version 1.2.0, and kotlin version 1.7.0.

The best way to figure out what versions you will need, is to go to the compatibility guide.

The version androidx.compose.compiler:compiler:1.2.1 doesn't exist.
You can check it in the google maven repo

enter image description here

You can in any case use the stable version of the module compiler 1.3.0 and all the other compose dependencies at 1.2.1:

buildscript {
    ext {
        compose_compiler = '1.3.0'
        compose_version = '1.2.1'
    }
    //...
}

and then:

composeOptions {
    kotlinCompilerExtensionVersion compose_compiler
}

dependencies {
   // stable 1.2.1 releases
   implementation "androidx.compose.material:material:$compose_version"
   //... 
}

As described in the documentation the compiler 1.3.0 requires kotlin 1.7.10:

Related