文章目录

  • 一、 报错信息
  • 二、 解决方案

一、 报错信息


导入了一个 Eclipse 项目 , 编译后报如下错误 :

FAILURE: Build failed with an exception.* What went wrong:
A problem occurred configuring root project 'MidiSheetMusic_02'.
> Could not resolve all artifacts for configuration ':classpath'.> Could not find com.android.tools.build:gradle:4.2.1.Searched in the following locations:- https://jcenter.bintray.com/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.pomIf the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.Required by:project :* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'MidiSheetMusic_02'.Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.tools.build:gradle:4.2.1.
Searched in the following locations:- https://jcenter.bintray.com/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:project :* Get more help at https://help.gradle.orgBUILD FAILED in 1s

二、 解决方案


检查了下根目录下的 build.gradle 配置 , 发现只配置了 jcenter 仓库 ;

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {jcenter()}dependencies {classpath 'com.android.tools.build:gradle:4.2.1'}
}allprojects {repositories {jcenter()}
}

添加 google 仓库 和 mavenCentral 仓库 , 问题解决 ;

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {google()mavenCentral()jcenter()}dependencies {classpath 'com.android.tools.build:gradle:4.2.1'}
}allprojects {repositories {google()mavenCentral()jcenter()}
}

【错误记录】Android Studio 编译报错 ( Could not find com.android.tools.build:gradle:4.2.1. )相关推荐

  1. 【错误记录】Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. ② | 升级 Gradle 版本 )

    文章目录 一.报错信息 二.解决方案 解决 Could not determine java version from '11.0.8'. 问题 , 有两种方案 , 方案一 : Android Stu ...

  2. 【错误记录】Android Studio 编译报错 ( SDK location not found )

    文章目录 一.报错信息 二.解决方案 一.报错信息 Android Studio 编译报错 : 首次打开别人的项目 , 经常性的报错 ; Could not determine the depende ...

  3. 【错误记录】Android Studio 编译报错 ( A problem occurred starting process ‘command ‘ninja.exe‘ ‘ )

    文章目录 一.报错信息 二.解决方案 一.报错信息 Android Studio 编译报错 : FAILURE: Build failed with an exception.* What went ...

  4. 【错误记录】Android Studio 编译报错 ( Deprecated Gradle features were used in this build, making it incompat )

    文章目录 一.报错信息 二.解决方案 一.报错信息 使用 Android Studio 编译比较老的 Android 项目时 , 报如下错误 : FAILURE: Build failed with ...

  5. 【错误记录】Android Studio 编译报错 ( Invalid Gradle JDK configuration found )

    文章目录 一.报错信息 二.解决方案 一.报错信息 Android Studio 编译时提示 Invalid Gradle JDK configuration found 错误 ; 一般是打开一个新的 ...

  6. 【错误记录】Android Studio 编译报错 ( Error:Connection timed out: connect | 更新配置依赖仓库方式 )

    文章目录 一.报错信息 二.解决方案 一.报错信息 编译 VirtualAppEx 源码时 , 报如下错误 : Gradle 'VirtualAppEx-master' project refresh ...

  7. 【错误记录】Android Studio 编译报错 ( Gradle 下载错误导致 Failed to open zip file 报错 )

    文章目录 一.报错信息 二.解决方案 1.修改 gradle-wrapper.properties 配置 ( 失效解决方案 ) 2.手动干预 Gradle 目录 ( 推荐 ) 3.手动下载 Gradl ...

  8. 【错误记录】Android Studio 编译报错 ( Installed Build Tools revision 31.0.0 is corrupted )

    文章目录 一.报错信息 二.解决方案 一.报错信息 Executing tasks: [:dex_demo:assembleDebug, :app:assembleDebug] in project ...

  9. 【错误记录】Kotlin 编译报错 ( Class ‘Xxx‘ is not abstract and does not implement abstract member )

    文章目录 一.报错信息 二.解决方案 一.报错信息 Google Play 上架要求 Android 的编译版本 和 目标版本都要高于 30 才可以上传 ; 将 Android 的编译版本 和 目标版 ...

最新文章

  1. python太阳花绘图_python中turtle如何画太阳花?
  2. Outlook收不到邮件, 或者收邮件很慢, 怎么办?
  3. 【cocos2d-x】Lua中的table函数库
  4. Android深度探索(卷1)HAL与驱动开发读后感---第四章
  5. 一起学并发编程 - 钩子函数(shutdownHook)
  6. 乐器演奏_深度强化学习代理演奏的蛇
  7. cheetah的中文_cheetah是什么意思_cheetah的翻译_音标_读音_用法_例句_爱词霸在线词典...
  8. mysql内存数据库性能_Mysql内存表配置及性能测试
  9. 「雕爷学编程」Arduino动手做(19)—震动报警模块
  10. 项目分布式部署那些事(1):ONS消息队列、基于Redis的Session共享,开源共享
  11. Java基础Character类、Math类、Date类、DateFormat类、Calendar类
  12. jar 添加环境变量
  13. H3C网络故障排除方法
  14. 数据结构(Java)-树-堆排序的实现
  15. python 删除pdf页面_删除PDF其中几页的方法
  16. HTTP协议知识点总结
  17. 《52讲轻松搞定网络爬虫》读书笔记 - HTTP基本原理
  18. YouTube大转型:视频红人靠粉丝会员创收 不再依赖广告
  19. 双向链表插入、删除操作
  20. 如何系统学习计算机硬件和软件,怎么升级电脑硬件和软件

热门文章

  1. 信息资源管理的标准与法规
  2. .h头文件 .lib库文件 .dll动态链接库文件关系
  3. 小心!目录删除及重命名操作 ,一定丢失Session~~!
  4. 231 Power of Two 2的幂
  5. JQuery 实现 锚点跳转
  6. Educational Codeforces Round 7 B. The Time 水题
  7. 应该知道的Linux技巧
  8. c++ -- 构造函数与析构函数
  9. accept系统调用内核实现
  10. [转]c++之菱形继承