简体   繁体   English

Android Studio“找不到com.android.tools.build:gradle:3.0.1”

[英]Android Studio “Could not find com.android.tools.build:gradle:3.0.1”

I'm trying to build an Andoid Studio project and failing. 我正在尝试构建Andoid Studio项目,但失败了。 I cloned the repo. 我克隆了仓库。 from GitHub, including: build.gradle, gradle-wrapper.properties, gradle.properties, settings.gradle and local.properties. 来自GitHub,包括:build.gradle,gradle-wrapper.properties,gradle.properties,settings.gradle和local.properties。

When I try to build, the Build window shows: 当我尝试构建时,“构建”窗口显示:

Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
    project :photo-crop-library
Open File

Note there is no 'just fix it' link in the above message. 请注意,以上消息中没有“仅修复它”链接。 The text "Open File" is a link which, when clicked, opens build.gradle, which contains 文本“打开文件”是一个链接,单击该链接可打开build.gradle,其中包含

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:3.0.0'

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

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

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

That first classpath line used to contain classpath 'com.android.tools.build:gradle:3.0.1' but I followed the advice in Could not find com.android.tools.build.gradle:3.0.0-alpha7 to change to 3.2.1, but it didn't fix it. 该第一条类路径曾经包含类路径'com.android.tools.build:gradle:3.0.1',但是我遵循了com.android.tools.build.gradle:3.0.0-alpha7中的建议以将其更改为3.2.1,但它没有修复。

Looking at the links in the error message, going to https://jcenter.bintray.com/com/android/tools/build/gradle , the highest version link shown on that page is 2.5.0-alpha-preview-02 so it looks like the link is wrong. 查看错误消息中的链接,转到https://jcenter.bintray.com/com/android/tools/build/gradle ,该页面上显示的最高版本链接是2.5.0-alpha-preview-02,因此看起来链接有误。 I am a complete Android Studio newbie; 我是一名完整的Android Studio新手; how do I change that link? 如何更改该链接? About Android Studio shows: 关于Android Studio显示:

Android Studio 3.3
Build #AI-182.5107.16.33.5199772, built on December 25, 2018
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.18.5-gentoo.efi

Thanks in expectation of any help. 感谢您的帮助。

that error message does not match the provided build.gradle the least ... 该错误消息与提供的build.gradle至少不匹配...

because it originates from module :photo-crop-library , which has it's own build.gradle . 因为它源自模块:photo-crop-library ,它具有自己的build.gradle

a) try updating to: a)尝试更新为:

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'
    classpath 'com.google.gms:google-services:4.2.0'
}

b) try to place repository google() in the line above jcenter() . b)尝试将存储库google()放在jcenter()上方的行中。

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

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