出现kotlin简化写法无法使用,即Plugin [id: ‘kotlin-android‘] was not found in any of the following sources.....

本文介绍了在Android Studio中遇到Kotlin插件无法使用的问题,详细阐述了解决方案,包括更新Gradle版本,修改build.gradle文件中的依赖,并针对模块化项目提供了额外的配置建议。同时,还提到了Android的View Binding新写法。

参考:【错误记录】Android Studio 中 Kotlin 版本报错 ( Module was compiled with an incompatible version of Kotlin. T )_51CTO博客_android studio运行kotlin

错误提示:Failed to apply plugin [id 'kotlin-android']
   > The current Gradle version 5.6.4 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1.1 or newer, or the previous version of the Kotlin plugin.

第一步,在project下的build.gradle中的repositories下添加(注意:buildscript和allprojects下都有repositories):

repositories { 
    jcenter() 
    google() 
}

第二步,同样在project下的dependencies中添加下面这句(后面的版本需要按照对照表来,否则肯定出错,PS:kotlin版本要按照对照表来,我这里定了1.4.20)(我这里是4

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值