简体   繁体   English

如何解决此Gradle错误?

[英]How to Solve this Gradle error?

I got this error in Gradle Console 我在Gradle Console中收到此错误

Error:A problem occurred configuring root project 'QuakeReport'. 错误:配置根项目“ QuakeReport”时出现问题。

Could not resolve all files for configuration ':classpath'. 无法解析配置':classpath'的所有文件。 Could not find com.android.tools.build:gradle:3.0.0. 找不到com.android.tools.build:gradle:3.0.0。 Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar Required by: project : 在以下位置搜索:文件:/ Applications / Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom文件:/ Applications / Android Studio .app / Contents / gradle / m2repository / com / android / tools / build / gradle / 3.0.0 / gradle-3.0.0.jar https://jcenter.bintray.com/com/android/tools/build/gradle/ 3.0.0 / gradle-3.0.0.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar由以下项目提供:

  • Try: Run with --stacktrace option to get the stack trace. 尝试:使用--stacktrace选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. 使用--info或--debug选项运行以获取更多日志输出。

  • Get more help at https://help.gradle.org https://help.gradle.org上获得更多帮助

BUILD FAILED in 41s 建立失败41秒钟

I got this error in messages 我在消息中收到此错误

Error:A problem occurred configuring root project 'QuakeReport'. 错误:配置根项目“ QuakeReport”时出现问题。

Could not resolve all files for configuration ':classpath'. 无法解析配置':classpath'的所有文件。 Could not find com.android.tools.build:gradle:3.0.0. 找不到com.android.tools.build:gradle:3.0.0。 Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar Required by: project : 在以下位置搜索:文件:/ Applications / Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom文件:/ Applications / Android Studio .app / Contents / gradle / m2repository / com / android / tools / build / gradle / 3.0.0 / gradle-3.0.0.jar https://jcenter.bintray.com/com/android/tools/build/gradle/ 3.0.0 / gradle-3.0.0.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar由以下项目提供:

Android artifacts are no longer posted to bintray. Android工件不再发布到Bintray。 Use google's repository to your build script. 使用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'
    }
}

See here: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#apply_plugin 参见此处: https : //developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#apply_plugin

try adding this to your project level build.gradle. 尝试将其添加到您的项目级别build.gradle。

  // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM