kotlinCompilerVersion is deprecated

Issue

I’ve just started a new Jetpack Compose project using the "Empty Compose Activity" Android Studio (2020.3.1 Canary 14) template, but I’m getting the following warning in my build.gradle.kts (:app) file:

‘kotlinCompilerVersion: String?’ is deprecated.

enter image description here

The deprecation does not provide any information about what to use instead. Should I simply remove this option or do something else?

Solution

kotlinCompilerVersion can be safely removed.
Compose now uses the kotlin compiler defined in your buildscript.

buildscript {
    ext.kotlin_version = '1.5.21'
    //....
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

If you are using the plugins block (in settings.gradle or build.gradle)

pluginManagement {
    //..
    plugins {
        id 'org.jetbrains.kotlin.android' version '1.5.21' 
    }
}

Answered By – Gabriele Mariotti

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published