在Android Studio中设置Http代理 [英] Set up Http Proxy in Android Studio

查看:1371
本文介绍了在Android Studio中设置Http代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了多个类似的问题和文档,但是无法解决我的机器被公司防火墙挡在后面的问题.我收到的错误是无法刷新Gradle项目"未知主机services.gradle.org.我阅读并理解的所有内容都使我相信这是一个http代理问题.我尝试在我的Project文件夹的gradle.properties文件中设置代理属性,以便gradle.properties文件看起来像:

I have read multiple similar questions and the documentation but I have not been able to solve my issue of getting by the corporate firewall my machine sits behind. The error I am getting is 'Failed to refresh Gradle project' Unknown host services.gradle.org. Everything I have read and understand lead me to believe this is a http proxy issue. I have tried setting the proxy properties in the gradle.properties file in my Project folder so my gradle.properties file looks like :

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -    Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
#  http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=83
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain

systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=83
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.auth.ntlm.domain=domain

我还尝试通过转到File-> Settings-> Gradle并使用以下方式设置Gradle VM选项来设置Global Gradle Settings:

I have also tried setting the Global Gradle Settings by going File->Settings->Gradle and setting the Gradle VM Options using:

-Dhttp.proxyHost=proxy.company.com -Dhttp.proxyPort=83 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password

我看不到任何其他文档来说明在何处设置此http代理设置,如果可以的话,请帮忙.

I cannot see any documentation of where else to set this http proxy setting, please help if you can.

推荐答案

尝试将域添加到gradle全局设置中

try to add domain into gradle global settings

-Dhttp.proxyHost=proxy.company.com -Dhttp.proxyPort=83 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password -Dhttp.auth.ntlm.domain=domain

对我有帮助.

这篇关于在Android Studio中设置Http代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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