Android 无法解析配置 ':classpath' 的所有依赖项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25994163/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not resolve all dependencies for configuration ':classpath'
提问by Nabdreas
I cant seem to get build tools for the latest gradle at all. I suspect its something to do with proxy setting for gradle. I have had a good look online but still cant seem to find a solution. I use gradle 2.1.
我似乎根本无法获得最新 gradle 的构建工具。我怀疑它与 gradle 的代理设置有关。我在网上好好看看,但似乎仍然找不到解决方案。我使用 gradle 2.1。
I created gradle.properties file in my /home/user/.gradle folder with these setting.
我使用这些设置在我的 /home/user/.gradle 文件夹中创建了 gradle.properties 文件。
systemProp.http.proxyHost=proxy systemProp.http.proxyPort=80 systemProp.http.proxyUser=myusername systemProp.http.proxyPassword=password
systemProp.https.proxyHost=proxy systemProp.https.proxyPort=80 systemProp.https.proxyUser=myusername systemProp.https.proxyPassword=password
systemProp.http.proxyHost=proxy systemProp.http.proxyPort=80 systemProp.http.proxyUser=myusername systemProp.http.proxyPassword=password
systemProp.https.proxyHost=proxy systemProp.https.proxyPort=80 systemProp.https.proxyUser=myusername systemProp.https.proxyPassword=password
Here is my global build.gradle
这是我的全局build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.0'
classpath fileTree(dir: 'build-libs', include: '*.jar')
}
}
allprojects {
repositories {
mavenCentral()
}
}
And here is the error i get when running grawlew Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'.peer not authenticated
这是我在运行 grawlew 时遇到的错误 无法 HEAD ' https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'。对等体未通过身份验证
What am i missing? that maven link opens fine in a browser.
我错过了什么?该 Maven 链接在浏览器中打开正常。
采纳答案by Nabdreas
Right im not sure if it will work for others but worked for me.
对,我不确定它是否对其他人有用,但对我有用。
I changed proxyPort to 8080 and used jcenter instead of Maven. But i had to apply expeption to use HTTP instead of HTTPS. This is what i have in my gradle.buildfor build script and allprojects
我将 proxyPort 更改为 8080 并使用 jcenter 而不是 Maven。但是我不得不申请 expeption 来使用 HTTP 而不是 HTTPS。这就是我在gradle.build 中用于构建脚本和所有项目的内容
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
UPDATE: 06/08
更新:06/08
I have recently updated Gradle and plugin version and had some problems. It was complaining about plugin com.android.application
我最近更新了 Gradle 和插件版本,但遇到了一些问题。它在抱怨插件com.android.application
I did some digging around and changed
我做了一些挖掘并改变了
jcenter {
url "http://jcenter.bintray.com/"
}
to
到
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
回答by vikas kumar
For newer android studio 3.0.0and gradleupdate, this needed to be included in project level build.gradlefile for android Gradle build tools and related dependencies since Googlemoved to its own maven repository.
对于较新的android studio 3.0.0和gradle更新,这需要包含在android Gradle 构建工具和相关依赖项的项目级build.gradle文件中,因为Google移到了自己的 maven 存储库。
// 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
}
回答by ?????
Find and Replace:
查找和替换:
jcenter()
maven {
url "https://maven.google.com"
}
to:
到:
maven {
url "https://maven.google.com"
}
jcenter()
回答by monkeyM
I'm using Gradle plugin 3.0.1 and saw this error. Not sure what caused this but the solution that works for me is to stop the running Gradle daemon by ./gradlew --stop
.
我正在使用 Gradle 插件 3.0.1 并看到此错误。不确定是什么原因造成的,但对我有用的解决方案是通过./gradlew --stop
.
回答by Honsen
I try to modify the repositories and import the cer to java, but both failed, then I upgrade my jdk version from 1.8.0_66 to 1.8.0_74, gradle build success.
我尝试修改存储库并将 cer 导入 java,但都失败了,然后我将 jdk 版本从 1.8.0_66 升级到 1.8.0_74,gradle 构建成功。
回答by Praveen Yadav
late but it worked for me:
change your dns setting by going Network and sharing center.
In left pane choose change adapter setting
-right click on your network connection
-properties
-select ipv4
-properties
- now in dns server setting:-
-choose the option use the following dns server addresses
and use google dns server 8.8.8.8 as preferred dns serverand
8.8.4.4 as alternate dns server.
晚了,但对我
有用:通过转到网络和共享中心来更改您的 dns 设置。
在左窗格中选择更改适配器设置 -
右键单击您的网络连接
-属性-
选择ipv4
-属性
- 现在在 dns 服务器设置中:- -
选择选项使用以下 dns 服务器地址
并使用 google dns 服务器8.8.8.8 作为首选 dns服务器和
8.8.4.4 作为备用 dns 服务器。
it will solve your problem.
它会解决你的问题。
回答by Quentin Malguy
The solution is in your build.gradle change this block:
解决方案是在您的 build.gradle 中更改此块:
allprojects {
repositories {
jcenter()
google()
}
}
to google in first position :
谷歌排名第一:
allprojects {
repositories {
google()
jcenter()
}
}
回答by nidhi chaudhary
I got the same problem. Just use File->INVALIDATE CACHES AND RESTART
我遇到了同样的问题。只需使用 File->INVALIDATE CACHES 并重新启动
回答by Supriya
**A problem occurred evaluating project ':app'.
**评估项目“:app”时出现问题。
Could not resolve all files for configuration 'classpath'.**
无法解析配置“类路径”的所有文件。**
Solution:Platform->cordova-support-google-services
解决方案:平台->cordova-support-google-services
In this file Replace classpath 'com.android.tools.build:gradle:+'to this classpath 'com.android.tools.build:gradle:3.+'
在这个文件中,将类路径 'com.android.tools.build:gradle:+'替换 为这个 类路径 'com.android.tools.build:gradle:3.+'
回答by Behzad Fattahi
If adding google()
into your build.gradle
doesn't work try adding it at first place in your repositories section of node_modules/YOUR_PACKAGE/android/build.gradle
file.
如果添加google()
到您的文件build.gradle
中不起作用,请尝试在node_modules/YOUR_PACKAGE/android/build.gradle
文件的存储库部分首先添加它。