最近开始学习Android Studio开发,发现老是连接超时,下面配置下国内镜像源和HTTP代理,而且通过尝试发现最快下载速度方法
一.配置 SDK 镜像源
打开 Android Studio。
进入 File > Settings 然后点击 System Settings,点击 Android SDK。
https://i-blog.csdnimg.cn/direct/75416d8ffad4449d888bf0a9b8d404eb.png" />
在右侧找到 SDK Update Sites 列表,点击右侧的编辑按钮(一个小铅笔图标)。
https://i-blog.csdnimg.cn/direct/7d6f3c1b57ac485dbc841f8dc11e091a.png" />
在弹出的窗口中,将默认的 Google 镜像地址修改为国内的镜像地址,例如:
华为镜像:https://developer.huawei.com/repo/
豆瓣镜像:https://mirrors.douban.com/android/sdk/
腾讯: https://mirrors.cloud.tencent.com/AndroidSDK/
阿里: https://mirrors.aliyun.com/android.googlesource.com/
我使用的是
https://mirrors.cloud.tencent.com/AndroidSDK/
二、在gradle的wrapper中改变下载地址
如图
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.7-all.zip
https://i-blog.csdnimg.cn/direct/da1ace7deb724d5ba24f3ef96308ac17.png" width="1200" />
三.在setting.gradle.kts中输入以下代码
在setting.gradle.kts中两处repositories后加入以下代码
maven{url=uri("https://maven.aliyun.com/repository/google")}
maven{url=uri("https://maven.aliyun.com/repository/central")}
https://i-blog.csdnimg.cn/direct/833d5fc22b3b46eda4536b3daa617bd8.png" />
最后点击sync,重新下载
https://i-blog.csdnimg.cn/direct/5f715048a34b45bb936a48ae01e63113.png" />
最终等待两分钟左右, 下载成功,这里我已经下载过了,所以比较快。
https://i-blog.csdnimg.cn/direct/78779651e7954e678371eba6856b7dd9.png" />
下载成功后项目结构变化
https://i-blog.csdnimg.cn/direct/d8b8080a5825409eae4619ca723f2988.png" />如果想改变项目显示,如图
https://i-blog.csdnimg.cn/direct/23ffd27855a54643a0c9d2ec89ffbd0e.png" />
在app-src-main-res-layout中开始页面设计
https://i-blog.csdnimg.cn/direct/f274109d55504b799cc2c68052b35340.png" />
开始你的Hello World!的吧
谢谢阅读,如有不足请见谅。