从 Compose 1.0.1 开始,在哪里为 Compose 指定 Kotlin 版本? [英] Where to specify Kotlin Version for Compose as of Compose 1.0.1?

查看:133
本文介绍了从 Compose 1.0.1 开始,在哪里为 Compose 指定 Kotlin 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不推荐使用 composeOptions 中的 kotlinCompilerVersions,之后 compose 只使用项目级构建文件中定义的 kotlin 版本.现在,即使这似乎已被弃用,因为从 compose 1.0.1 开始,buildScript 中没有指定 kotlin 版本.现在怎么更新?事实上,'去哪里'?我无法构建项目.

The use of kotlinCompilerVersions in composeOptions was deprecated, after which compose just used the kotlin version defined in the project level build file. Now, even that seems to be deprecated, since as of compose 1.0.1, there is no kotlin version specified in the buildScript. How to update it now? In fact, 'where' to? I am unable to build project.

这就是我的项目级构建中的全部

This is all there is in my project-level build

task clean(type: Delete) {
    delete rootProject.buildDir
}

buildscript {
    ext {
        compose_version = '1.0.1'
    }
}

很明显,没有在任何地方定义 kotlin 版本(应用级构建也是如此),但很明显版本是从某处获取的,导致编译器错误.这就是我想知道的 - 从哪里获取版本,是否以及如何修改.

As is clear, there IS no kotlin version defined anywhere (the same is true for the app level build), but it is clear that the version IS being picked up from somewhere, leading to the compiler error. That is what I want to know - From where the version is being picked up, and if, and how I can modify the same.

我目前收到此错误

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

好吧,我不想压制警告.如果有其他解决方案,我会很感激您的帮助

Well, I do not want to suppress the warning. If there's another solution, I'd appreciate your help

谢谢!

推荐答案

终于找到了.有一个名为 settings.gradle(Project) 的文件.版本是在插件块中预定义的

Finally found where it is. There's a file named settings.gradle(Project). The version was pre-defined in the plugins block

在这里

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
    plugins {
        id 'com.android.application' version '7.1.0-alpha06'
        id 'com.android.library' version '7.1.0-alpha06'
        id 'org.jetbrains.kotlin.android' version '1.5.10' // Right here 
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "OrgFarm"
include ':app'

这篇关于从 Compose 1.0.1 开始,在哪里为 Compose 指定 Kotlin 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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