android gradle的优化
在setting.gradle.kts配置
google()maven("https://maven.aliyun.com/repository/google")// 官方 Maven Central,最通用mavenCentral()// 特殊仓库(4thline,Cling 用)maven {url = uri("http://4thline.org/m2")isAllowInsecureProtocol = true}maven("https://jitpack.io")//maven("https://maven.joyyinc.com/nexus/content/groups/public")//jcenter()
不宜配置太多maven,否则,下载依赖的时候,就算你下载成功,依赖也会根据maven一次次循环下载依赖,非常浪费时间。
需要修改依赖请求超时时间,默认30秒太慢了,改成10,会节省很多时间。配置写在gradle.properties里面。
systemProp.org.gradle.internal.http.connectionTimeout=10000 systemProp.org.gradle.internal.http.socketTimeout=10000