安卓工作室 : Gradle failed to resolve Dependencies

标签 android maven android-studio android-gradle-plugin

我最近将一个eclipse项目迁移到了androidStudio。但是在构建 AS 时未能解决依赖关系。起初我认为这可能是代理问题,因为我在受限网络中,所以我添加了代理设置没有结果。 所以我在终端中尝试了 gradlew,输出如下:

Could not resolve all dependencies for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:2.3.2. Required by: project : Could not resolve com.android.tools.build:gradle:2.3.2. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.pom'. This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server

所以我尝试从我的浏览器访问“https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.pom”,它成功地下载了文件。这意味着网络正常。

那么为什么 AS studio 无法解决依赖关系? gradle版本有问题吗? 我如何决定哪个 gradle 版本适合我的项目?

感谢您的回复。

最佳答案

尝试:

首先:

repositories {
    jcenter({url "http://jcenter.bintray.com/"})
}

如果不行,Gradle手动同步代理

gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8580

关于安卓工作室 : Gradle failed to resolve Dependencies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44063539/

相关文章:

android - 当断点位于方法的第一行时,在 Android Studio 中看不到参数值

android - 无法在 Android 设备上运行 ionic 应用程序

android - 在 Eclipse 中使用 NDK

java - Android 时间与 Java 时间之间的转换

android-studio - Kotlin Scratch File Android Studio readline()

android - 无法在 Android Studio 中添加 Android Assets 。选项去哪儿了?

android - 包裹解码未知类型代码

eclipse - 在 Eclipse 中显示 Maven War Overlay 文件

java - 自动解析自定义 jar 的依赖关系层次结构

maven - 具有Gitlab CI的Fabric8io插件