出现该错误的主要原因是当前仓库中没有适合的包,添加国内的maven源即可,具体方法如下:
在 Gradle Scripts->build.gradle 中添加以下国内镜像仓库,注意两个地方都要加:文章来源:https://www.toymoban.com/news/detail-545891.html
maven {
url 'https://maven.aliyun.com/repository/google'
}
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
url 'https://maven.aliyun.com/repository/jcenter'
}
全部代码:文章来源地址https://www.toymoban.com/news/detail-545891.html
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// ext.kotlin_version = '1.3.72'
ext.kotlin_version = "1.5.0"
repositories {
maven {
url 'https://maven.aliyun.com/repository/google'
}
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
url 'https://maven.aliyun.com/repository/jcenter'
}
google()
// jcenter()
}
dependencies {
// 4.1.0-alpha10 or above and Android Studio 4.1 Canary 10 or above is required for
// TensorFlow Lite / Machine Learning (ML) binding
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
maven {
url 'https://maven.aliyun.com/repository/google'
}
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
url 'https://maven.aliyun.com/repository/jcenter'
}
google()
// jcenter()
}
}
到了这里,关于解决Could not find org.jetbrains.kotlin:kotlin-gradle-plugin * 错误方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!