无法解析配置 ':classpath' 的所有依赖项 [英] Could not resolve all dependencies for configuration ':classpath'
问题描述
我似乎根本无法获得最新 gradle 的构建工具.我怀疑它与 gradle 的代理设置有关.我在网上好好看看,但似乎仍然找不到解决方案.我使用 gradle 2.1.
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.
我使用这些设置在我的/home/user/.gradle 文件夹中创建了 gradle.properties 文件.
I created gradle.properties file in my /home/user/.gradle folder with these setting.
systemProp.http.proxyHost=代理systemProp.http.proxyPort=80systemProp.http.proxyUser=我的用户名systemProp.http.proxyPassword=密码
systemProp.http.proxyHost=proxy systemProp.http.proxyPort=80 systemProp.http.proxyUser=myusername systemProp.http.proxyPassword=password
systemProp.https.proxyHost=proxysystemProp.https.proxyPort=80systemProp.https.proxyUser=我的用户名systemProp.https.proxyPassword=密码
systemProp.https.proxyHost=proxy systemProp.https.proxyPort=80 systemProp.https.proxyUser=myusername systemProp.https.proxyPassword=password
这是我的全局 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()
}
}
这是我在运行 gradlew
Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'.
peer not authenticated
我错过了什么?该 Maven 链接在浏览器中打开正常.
What am I missing? that maven link opens fine in a browser.
推荐答案
是的,我不确定它是否适用于其他人但适用于我.
Right, I'm not sure if it will work for others but worked for me.
我将 proxyPort
更改为 8080 并使用 jcenter 而不是 Maven.但是我不得不申请 expeption 来使用 HTTP 而不是 HTTPS.这是我在 build.gradle 中用于构建脚本和所有项目
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 build.gradle for build script and allprojects
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
更新:06/08
我最近更新了 Gradle 和插件版本,但遇到了一些问题.它在抱怨插件 com.android.application
I have recently updated Gradle and plugin version and had some problems. It was complaining about plugin com.android.application
我做了一些挖掘和改变
jcenter {
url "http://jcenter.bintray.com/"
}
到
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
这篇关于无法解析配置 ':classpath' 的所有依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!