前言
最近在尝试编译运行一个上古项目 https://github.com/bewantbe/audio-analyzer-for-android ,打开界面猛然发现曾经用过,然而是不知道被转手几次的广告版,下载好代码,还是老项目的日常 bug,各种 deprecated. 一键 refactor 到 Androidx 后,还是出 bug,也就是题目提到的 Read timed out
,有趣的是,不同于其他的 bug ,该 bug 没有任何修复提示。
搜索后可以知道主要原因是 gradle 库下载超时。更换 gradle 源到国内(阿里镜像)即可。
正文
打开项目的 build.gradle,替换为下面的内容即可。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| buildscript { repositories { maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } maven { url "https://maven.aliyun.com/repository/google" } maven { url "https://maven.aliyun.com/repository/public" } maven { url "https://maven.aliyun.com/repository/jcenter" } maven { url "https://maven.aliyun.com/repository/gradle-plugin" } google() mavenCentral() maven { url 'https://maven.google.com/' name 'Google' } } dependencies { classpath 'com.android.tools.build:gradle:7.0.2' } }
allprojects { repositories{ maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } maven { url "https://maven.aliyun.com/repository/google" } maven { url "https://maven.aliyun.com/repository/public" } maven { url "https://maven.aliyun.com/repository/jcenter" } maven { url "https://maven.aliyun.com/repository/gradle-plugin" } google() mavenCentral() maven { url "https://jitpack.io" } maven { url 'https://maven.google.com/' name 'Google' } maven { url "https://jitpack.io" } mavenCentral() } }
|