我正在尝试将gradle从1.3.1更新到3.5,因为我的一些依赖项需要3.3或更高版本。
我也见过类似的问题,但都没有帮助。
build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5'
}
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
不过,当我尝试做任何事情(建造、清洁等)时,我还是会得到这样的感觉:
Building and installing the app on the device (cd android && ./gradlew installDebug...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'chat'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.5.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.jar
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
发布于 2020-12-01 11:51:23
我在buildscript
和allprojects
存储库中都进行了Could not find gradle-3.5.3
回购,但仍然显示了Could not find gradle-3.5.3
错误。
最后,我添加了maven { url "https://maven.google.com" }
,它修复了错误!
项目级别build.gradle:
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
maven { url "https://maven.google.com" } // <= this line
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" } // <= this line
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
https://stackoverflow.com/questions/43497280
复制相似问题