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

时间:2019-01-20 02:52:25

标签: android gradle

我正在尝试构建Andoid Studio项目,但失败了。我克隆了仓库。来自GitHub,包括:build.gradle,gradle-wrapper.properties,gradle.properties,settings.gradle和local.properties。

当我尝试构建时,“构建”窗口将显示:

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

请注意,以上消息中没有“仅修复它”链接。文本“打开文件”是一个链接,单击该链接将打开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
}

该第一行 classpath 用于包含 classpath'com.android.tools.build:gradle:3.0.1',但我遵循了Could not find com.android.tools.build.gradle:3.0.0-alpha7中的建议更改为3.2.1,但并没有解决。

查看错误消息中的链接,转到https://jcenter.bintray.com/com/android/tools/build/gradle,该页面上显示的最高版本链接是2.5.0-alpha-preview-02,因此看起来该链接有误。我是一名完整的Android Studio新手;如何更改该链接? 关于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

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

该错误消息与提供的build.gradle至少不匹配...

因为它起源于模块:photo-crop-library,而模块build.gradle具有自己的dependencies { classpath 'com.android.tools.build:gradle:3.3.0' classpath 'com.google.gms:google-services:4.2.0' }

a)尝试更新为:

google()

b)尝试将存储库jcenter()放在#include <iostream> using namespace std; int main() { int N; cin>>N; int A[N]; /*That would work in CLion,Codeblocks&CodeForces but bring an error on visual studio */ //int*A=new int[N] That's how it must work at visual studio IDE 上方的行中。