9

I upgraded to Android Studio (2020.3.1) Canary 15 and started to get compiler errors.

The error generated is

e: This version (1.0.0-alpha13) of the Compose Compiler requires Kotlin version 1.4.30 but you appear to be using Kotlin version 1.4.32 which is not known to be compatible. Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!).

App configuration versions are:

    ext {
        gms_version = "4.3.5"
        agp_version = '7.0.0-alpha15'
        ktlint_version = "10.0.0"
        kotlin_version = "1.4.32"
        detekt_version = "1.16.0"
        versions_version = "0.36.0"
        dagger_version = "2.34.1-beta"
        crashlytics_gradle_version = "2.5.2"
        sceneform_version = "1.17.1"
        nav_version = "2.3.5"
        compose_version = "1.0.0-beta05"
    }

dependencies {
...
    // Compose dependencies
    implementation composeDependencies.composeUi
    implementation composeDependencies.composeTooling
    implementation composeDependencies.composeFoundation
    implementation composeDependencies.composeMaterial
    implementation composeDependencies.composeViewModel
    implementation networkDependencies.retrofit
    }

I have looked a similar issue that talk about this this issue, but it doesn't seem relevant in my case since I am not using a Compose activity.

Paul
  • 217
  • 3
  • 12

4 Answers4

4

I had the same problem, what i did was change in build.gradle:

"classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5"

to

"classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30"

AgentP
  • 6,261
  • 2
  • 31
  • 52
4

Android note : Change the kotlin gradle plugin version in the build.gradle Project:

In the buildscript > dependencies :

Change classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5"

To classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30"

I put 1.4.30 cause in my case didn't works on 1.4.32.

Link from info in this tutorial : Layouts in Jetpack Compose

MakiX
  • 326
  • 3
  • 8
2

You can downgrade to 1.4.30 or you can add a compiler option to ignore the warning

kotlinOptions {
    val options = listOf(
        "-P",
        "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"
    )
    freeCompilerArgs = freeCompilerArgs + options
}
Francesc
  • 25,014
  • 10
  • 66
  • 84
0

You may try this script under the project level module and Sync Gradle project.

buildscript {
    ext {
        //...
        kotlin_version = '1.4.30'
    }
    //...
    dependencies {
        //...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
Subarata Talukder
  • 5,407
  • 2
  • 34
  • 50