Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading to Android Studio (2020.3.1) Canary 15 causes Compose build error

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.

like image 298
Paul Avatar asked Apr 30 '21 20:04

Paul


People also ask

What version of Android Studio is arctic fox?

Android Studio - Arctic Fox | 2020.3.

What is new in bumblebee Android Studio?

Android Studio 2021.1 “Bumblebee” has a new Device Manager and improved Apple Silicon support. Android Studio is the main integrated development environment (IDE) for creating Android applications, with a feature-packed code editor, debugging tools, emulators, and much more.


Video Answer


3 Answers

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

like image 115
MakiX Avatar answered Oct 23 '22 02:10

MakiX


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"

like image 32
Joel Ibañez Avatar answered Oct 23 '22 02:10

Joel Ibañez


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
}
like image 25
Francesc Avatar answered Oct 23 '22 01:10

Francesc