问题存在原因:这是Android编译错误,jcenter里面的东西下载不了引起的。
问题解决:在项目的build.gradle文件中将jcenter()换成阿里的源,具体示例代码如下。修改之后再重新Sync Project即可。
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
// jcenter()
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
// jcenter()
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
}
本文介绍了一种常见的Android编译错误及其解决方案。错误源于jcenter无法下载所需资源,通过替换为阿里云的Maven仓库,可以有效解决此问题。文章提供了具体的Gradle配置示例,帮助开发者快速定位并修复错误。
1459

被折叠的 条评论
为什么被折叠?



