问题描述
Android端使用云构建打包编译时,出现“下载google资源超时”问题,如下图所示。其他国外资源下载超时,处理方式相同。
问题原因
中国内地网络访问海外资源受限制,需要使用阿里云镜像仓库。
解决方案
在工程根目录的build.gradle中,添加如下仓库地址。
buildscript {repositories {maven { url ‘http://maven.aliyun.com/nexus/content/groups/public/‘ }maven { url “http://maven.aliyun.com/nexus/content/repositories/google/“ }maven { url ‘http://maven.aliyun.com/nexus/content/repositories/releases/‘ }//google()jcenter()//建议将jcenter()放在阿里云Maven后面,避免优先从jcenter()下载。}dependencies {……}}
在工程的
/gradle/wrapper/gradle-wrapper.properties
文件中,更改gradle下载路径,如下所示。distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://emas-devops-cdn.aliyuncs.com/distributions/gradle-x.x.x-all.zip//或者distributionUrl=https\://emas-devops-cdn.aliyuncs.com/distributions/gradle-x.x.x-bin.zip
如果gradle版本提示找不到,请联系产品技术支持处理。
反馈
- 本页导读 (0)
文档反馈