软件编程
位置:首页>> 软件编程>> Android编程>> Android Studio配置国内镜像源(利用hosts)

Android Studio配置国内镜像源(利用hosts)

作者:LP_bin  发布时间:2023-05-29 18:47:54 

标签:Android,Studio,国内镜像源

之前我写过直接用国内镜像的IP地址端口进行配置国内镜像的,如下链接:

Android studio配置国内镜像源

但是这种方法不一定在每台电脑上的每次配置都行得通,因此给出第二种方法:给系统文件 hosts 添加国内的镜像(虽然……可能……也不一定……行得通 ^- ^ ,博主我亲测是可以的)

方法步骤:

一、配置hosts

找到hosts文件,用记事本或notepad++打开文件:

Android Studio配置国内镜像源(利用hosts)

在末尾加上如下映射,:

Android Studio配置国内镜像源(利用hosts)

其中 302.208.41.33是通过 http://ping.chinaz.com/ 该检测网站对进行域名 dl.google.com进行ping检测得到了,目前我这个还是可以用的,如果后来不行了可以去该网站ping dl.google.com 再另外找一个。

Android Studio配置国内镜像源(利用hosts)

二、配置Android Studio

打开Android studio 的根目录(可以右键AS的快捷图标找到其根目录),进入bin文件夹,用记事本或notepad++打开studio.exe.vmoptions或studio64.exe.vmoptions

如果系统是32位的就修改studio.exe.vmoptions,如果是64位就修改studio64.exe.vmoptions;不清楚自己系统的话就两个都改了

Android Studio配置国内镜像源(利用hosts)

添加以下数据:


-Djava.net.preferIPv4Stack=true
-Didea.updates.url=http://dl.google.com/android/studio/patches/updates.xml
-Didea.patches.url=http://dl.google.com/android/studio/patches/

如下图:

Android Studio配置国内镜像源(利用hosts)

Android studio的Setting中的配置如下:

Android Studio配置国内镜像源(利用hosts)

来源:https://blog.csdn.net/weixin_40849588/article/details/90575618

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com