gpt4 book ai didi

android - 错误 :Could not find com. android.tools.build :gradle:3. 0.0-beta2

转载 作者:太空宇宙 更新时间:2023-11-03 12:03:15 25 4
gpt4 key购买 nike

我在编译新的 gradle 时遇到问题,如下所示:

Error:Could not find com.android.tools.build:gradle:3.0.0-beta2. Searched in the following locations: file:/C:/Program Files/Android/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.pom file:/C:/Program Files/Android/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.jar https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.jar Required by: project : Open File

这是我的gradle:

buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.0-beta2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

最佳答案

你必须添加 gradle maven 仓库:

 maven { url 'https://maven.google.com' }

类似于:

buildscript {
//..
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
//..
}

如果您使用的是 Android Studio 3.x 和 gradle v.4,您还可以使用 google() 快捷方式

buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta-2'
}
}

关于android - 错误 :Could not find com. android.tools.build :gradle:3. 0.0-beta2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45874344/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com