build android5.1,Could not find com.android.tools.build:gradle:5.1.1

问题

I have tried all solution i can find online, like adding mavenCentrals and all that.

I can find 5.1.1 under .gradle, but it's complaining it does not find any version after 2.3 in the repo.

Could not find com.android.tools.build:gradle:5.1.1.

Searched in the following locations:

- file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/5.1.1/gradle-5.1.1.pom

- file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/5.1.1/gradle-5.1.1.jar

- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/5.1.1/gradle-5.1.1.pom

- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/5.1.1/gradle-5.1.1.jar

- https://jcenter.bintray.com/com/android/tools/build/gradle/5.1.1/gradle-5.1.1.pom

- https://jcenter.bintray.com/com/android/tools/build/gradle/5.1.1/gradle-5.1.1.jar

Required by:

project :

Open File

here's my build.gradle file

buildscript {

ext.kotlin_version = '1.3.0'

repositories {

google()

jcenter()

}

dependencies {

classpath 'com.android.tools.build:gradle:5.1.1'

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

classpath 'com.google.gms:google-services:3.4.0'

}

}

allprojects {

configurations.all {

resolutionStrategy.eachDependency { DependencyResolveDetails details ->

def requested = details.requested

if (requested.group == 'com.google.firebase') {

details.useVersion "15.+"

}

}

}

repositories {

google()

jcenter()

}

}

rootProject.buildDir = '../build'

subprojects {

project.buildDir = "${rootProject.buildDir}/${project.name}"

}

subprojects {

project.evaluationDependsOn(':app')

}

task clean(type: Delete) {

delete rootProject.buildDir

}

And I have distributionUrl = https://services.gradle.org/distributions/gradle-5.1.1-all.zip in gradle-wrapper.properties

回答1:

When you update Android Studio, you may receive a prompt to automatically update the Android Gradle plugin to the latest available version. You can choose to accept the update or manually specify a version based on your project's build requirements.

You should set PROPER classpath version.

dependencies {

classpath 'com.android.tools.build:gradle:3.4.0' //3.4.2 is latest

}

Set the Gradle version to 5.1.1 in the gradle-wrapper.properties file.

distributionUrl = https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

Read Android Gradle plugin.

Plugin version ----> Required Gradle version

3.1.0+ ----> 4.4+

3.2.0 ----> 3.2.1 4.6+

3.3.0 ----> 3.3.2 4.10.1+

3.4.0+ ----> 5.1.1+

4.0.1 ----> 6.1.1

来源:https://stackoverflow.com/questions/56016265/could-not-find-com-android-tools-buildgradle5-1-1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值