kotlinCompilerVersion 已弃用 [英] kotlinCompilerVersion is deprecated

查看:62
本文介绍了kotlinCompilerVersion 已弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用Empty Compose Activity"启动了一个新的 Jetpack Compose 项目.Android Studio (2020.3.1 Canary 14) 模板,但我在我的 build.gradle.kts (:app) 文件中收到以下警告:

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:字符串?'已弃用.

'kotlinCompilerVersion: String?' is deprecated.

弃用没有提供任何关于使用什么的信息.我应该简单地删除这个选项还是做其他事情?

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

推荐答案

kotlinCompilerVersion 可以安全删除.
Compose 现在使用 buildscript 中定义的 kotlin 编译器.

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"
    }
}

如果您正在使用 plugins 块(在 settings.gradlebuild.gradle 中)

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

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

这篇关于kotlinCompilerVersion 已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆