gradle版本/gradleplugin版本/Javajdk版本/kotlin版本

一、gradle 发布版本

参考:gradle 发布版本

Java版本兼容:

Java versionFirst Gradle version to support it
82.0
94.3
104.7
115.0
125.4
136.0
146.3
156.7
167.0
177.3

二、gradle 版本和 gradle 插件版本 匹配兼容

参考:gradle 版本和 gradle 插件版本 匹配兼容

下表列出了各个 Android Gradle 插件版本所需的 Gradle 版本。为了获得最佳性能,您应使用 Gradle 和插件这两者的最新版本。

插件版本所需的 Gradle 版本
1.0.0 - 1.1.32.2.1 - 2.3
1.2.0 - 1.3.12.2.1 - 2.9
1.5.02.2.1 - 2.13
2.0.0 - 2.1.22.10 - 2.13
2.1.3 - 2.2.32.14.1 - 3.5
2.3.0+3.3+
3.0.0+4.1+
3.1.0+4.4+
3.2.0 - 3.2.14.6+
3.3.0 - 3.3.34.10.1+
3.4.0 - 3.4.35.1.1+
3.5.0 - 3.5.45.4.1+
3.6.0 - 3.6.45.6.4+
4.0.0+6.1.1+
4.1.0+6.5+
4.2.0+6.7.1+
7.07.0+

可以在 Android Studio 的 File > Project Structure > Project 菜单中指定插件版本,也可以在顶级 build.gradle 文件中进行指定。

在这里插入图片描述

三、kotlin

官网 : kotlin 版本

Kotlin Gradle Plugin : maven 仓库

Kotlin releases

Kotlin Standard Library

maven仓库 : Kotlin Stdlib : Kotlin Standard Library for JVM

问题:Kotlin version that is used for building with Gradle (+) differs from the one bundled into the IDE plugin 1.5.20

Kotlin version that is used for building with Gradle (+) 
differs from the one bundled into the IDE plugin 1.5.20

查看Android studio 自带kotlin插件版本(保证stable版本):

在这里插入图片描述

查看项目中 kotlin 插件版本,改为stable版本即可:

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

在这里插入图片描述

问题 : Module was compiled with an incompatible version of Kotlin.The binary version of its metadata is 1.6.0, expected version is 1.4.0.

e: Incompatible classes were found in dependencies. 
Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors

e: /Users/tmk/.gradle/caches/modules-2/files-2.1/androidx.annotation/
annotation/1.4.0-alpha01/8c16c0d1fad0d41cdac0394c7fa16a25a4210248/
annotation-1.4.0-alpha01.jar!/META-INF/annotation.kotlin_module: 
Module was compiled with an incompatible version of Kotlin. 
The binary version of its metadata is 1.6.0, expected version is 1.4.0.

e: /Users/tmk/.m2/repository/org/jetbrains/kotlin/
kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/
META-INF/kotlin-stdlib-common.kotlin_module: 
Module was compiled with an incompatible version of Kotlin. 
The binary version of its metadata is 1.6.0, expected version is 1.4.0.

解决办法:

1、gradle-wrapper.properties 中将 gradle 版本升级一下

可参考:gradle版本发行

2、classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"kotlin 版本升级一下

可参考 : kotlin-gradle-plugin

  • 12
    点赞
  • 52
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值