Android Studio设置shadowsocks代理

来源:互联网 发布:win7输入法修复软件 编辑:程序博客网 时间:2024/05/05 18:17

为什么要用代理

如今android studio越来越流行,很多的android程序猿都开始转入anroid studio的大本营。但是GFW的封锁成为很多人的困扰,eg:无法更新sdk,无法使用如下方式添加类库:

compile 'com.android.support:support-v4:23.0.0'compile 'com.android.support:appcompat-v7:23.0.0'compile 'com.android.support:design:23.0.0'

翻墙软件有很多,我使用的是shadowsocks,选择Shadowsocks.com 普通版 ¥99.00CNY 年付。对于搞android开发的,我觉得这个很有必要而且价格也不是很贵。


如何设置代理

下面,开始讲如何设置android studio的shadowsocks代理:
File–>Settings… 按照下图配置

  1. 设置自动代理

    This will attempt to user your system settings and is useful if your system uses a proxy autoconfiguratioin file(.pac)

    • 勾选 Auto-detect proxy settings后android studio会自动走你操作系统设置的代理。
    • 勾选Automatic proxy configuration URL并设置本地pac文件

    这里写图片描述

  2. 设置手动代理
    由于ShadowSocks是socks方式所以需要按照下图的方式配置
    这里写图片描述

    点击ok后会在项目根目录的gradle.properties文件中生成如下代码:

    systemProp.http.proxyHost=127.0.0.1systemProp.http.proxyPort=1080

    到此,就配置完毕了。

0 0
原创粉丝点击