Android Studio Build报错:Could not download support-v4.aar (com.android.support:support-v4:28.0.0)
程序员文章站
2022-03-27 21:52:53
报错信息如下:Could not download recyclerview-v7.aar (com.android.support:recyclerview-v7:28.0.0) (这个问题搞了我一上午,太浪费时间啦!)ERROR: Unable to resolve dependency for ':AppDemo@debugUnitTest/compileClasspath': Could not download constraint-layout-solver.jar (com.andro....
报错信息如下:Could not download recyclerview-v7.aar (com.android.support:recyclerview-v7:28.0.0) (这个问题搞了我一上午,太浪费时间啦!)
ERROR: Unable to resolve dependency for ':AppDemo@debugUnitTest/compileClasspath': Could not download constraint-layout-solver.jar (com.android.support.constraint:constraint-layout-solver:1.1.3)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download support-v4.aar (com.android.support:support-v4:28.0.0)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download design.aar (com.android.support:design:28.0.0)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download constraint-layout.aar (com.android.support.constraint:constraint-layout:1.1.3)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download support-media-compat.aar (com.android.support:support-media-compat:28.0.0)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download recyclerview-v7.aar (com.android.support:recyclerview-v7:28.0.0)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download transition.aar (com.android.support:transition:28.0.0)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download cardview-v7.aar (com.android.support:cardview-v7:28.0.0)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@release/compileClasspath': Could not download constraint-layout-solver.jar (com.android.support.constraint:constraint-layout-solver:1.1.3)
Show Details
Affected Modules: AppDemo
ERROR: Unable to resolve dependency for ':AppDemo@releaseUnitTest/compileClasspath': Could not download support-v4.aar (com.android.support:support-v4:28.0.0)
Show Details
Affected Modules: AppDemo
原因分析:连接不上google的服务器
解决办法:1、购买VPN,*重新编译
2、找到工程级别的build.gradle文件,将
repositories { google() jcenter() mavenCentral() }
修改成阿里云的服务器
allprojects {
repositories {
//阿里的镜像地址(注意用这个)
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
//自己的工程
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
jcenter()
mavenCentral()
maven { url "https://dl.google.com/dl/android/maven2/" }
}
}
重新build工程。
本文地址:https://blog.csdn.net/Jason_996/article/details/111872321