无法解析 com.android.support:appcompat-v7:26.1.0.=>配置HTTP代理 [英] Could not resolve com.android.support:appcompat-v7:26.1.0. => configure HTTP proxy

查看:51
本文介绍了无法解析 com.android.support:appcompat-v7:26.1.0.=>配置HTTP代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了 Android Studio 3.0 并开始遵循

为了解决这个错误,我也必须为 Gradle 实现代理,方法是将这些行添加到 gradle.properties 文件中:

systemProp.http.proxyHost=127.0.0.1systemProp.http.nonProxyHosts=localhost, 127.0.0.1org.gradle.jvmargs=-Xmx1536msystemProp.http.proxyPort=8118systemProp.https.proxyHost=127.0.0.1systemProp.https.nonProxyHosts=localhost, 127.0.0.1systemProp.https.proxyPort=8118

将上述语句添加到gradle.properties后,错误得到解决.请注意, HTTPHTTPS 代理都需要添加到 Gradle 属性中

解决方案

我遇到了同样的错误.尝试了很多 stackoverflow 链接,但直到这个链接都没有帮助.在我的情况下,问题是由于 gradle.properties 文件中没有 https 代理设置.我包括它并且它起作用了.

对于 android studio 3,在你的项目的 build.gradle 文件中,你有这个:

所有项目{存储库{jcenter()谷歌()}}

jcenter() 在 https 上运行,因此如果您在使用 https 代理的网络(在大多数情况下是公司网络)中构建,并且您忘记将其包含在 gradle.properties 文件中,那么您可能会遇到问题.您可能会觉得 gradle 表现得很奇怪,但事实并非如此.它只是缺少正确的网络配置.即使是离线构建设置也不起作用,因为它仍然需要 jcenter() 在您第一次在最新的 Android Studio 中构建应用程序时下载文件.

我在 gradle.properties 中包含了我的 https 代理设置,如下所示:

systemProp.https.proxyHost=<代理服务器地址>systemProp.https.nonProxyHosts=localhost, 127.0.0.1systemProp.https.proxyPort=<端口号>

I downloaded Android Studio 3.0 and I started following along building my first app tutorial. But Gradle threw errors like:

Could not resolve com.android.support:appcompat-v7:26.1.0.

I searched on SO for similar problems like this and that, but none of them helps me.


Eventually I figured out that I'm using a proxy for Android Studio:

To resolve the error, I have to implement the proxy for Gradle too, by adding these lines to gradle.properties file:

systemProp.http.proxyHost=127.0.0.1
systemProp.http.nonProxyHosts=localhost, 127.0.0.1
org.gradle.jvmargs=-Xmx1536m
systemProp.http.proxyPort=8118

systemProp.https.proxyHost=127.0.0.1
systemProp.https.nonProxyHosts=localhost, 127.0.0.1
systemProp.https.proxyPort=8118

After adding the above statements to gradle.properties, the error got resolved. Note that both HTTP and HTTPS proxies need to be added to Gradle properties

解决方案

I had the same error. Tried a lot of stackoverflow links but none of them helped until this one. The problem in my case was due to https proxy settings which were not there in the gradle.properties file. I included it and it worked.

For android studio 3, inside build.gradle file of your project you have this:

allprojects {
    repositories {
        jcenter()
        google()
    }
}

The jcenter() runs over https and hence if you are building in a network(in most cases company network) which uses https proxy, and you forgot to include it in your gradle.properties file, then you are likely to face the issue. You may feel that gradle is behaving weird but its not. Its only missing the proper network configuration. Even offline build settings wont work since it still needs jcenter() to download files for the first time you are building an app in latest Android Studio.

I included my https proxy settings in gradle.properties like this:

systemProp.https.proxyHost=<proxy server address>
systemProp.https.nonProxyHosts=localhost, 127.0.0.1
systemProp.https.proxyPort=<port number>

这篇关于无法解析 com.android.support:appcompat-v7:26.1.0.=>配置HTTP代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆