返回顶部
首页 > 资讯 > 精选 >Android Studio报错:Could not resolve com.android.tools.build:gradle:8.0.0
  • 880
分享到

Android Studio报错:Could not resolve com.android.tools.build:gradle:8.0.0

androidandroidstudiogradle 2023-08-17 06:08:21 880人浏览 八月长安
摘要

一、报错信息 Android Studio 新建项目会报以下错误: Could not resolve com.android.tools.build:gradle:8.0.0. 完整版报错信息如下: A problem occurred

一、报错信息

Android Studio 新建项目会报以下错误:

Could not resolve com.android.tools.build:gradle:8.0.0.

完整版报错信息如下:

A problem occurred configuring root project 'My Application'.> Could not resolve all files for configuration ':classpath'.   > Could not resolve com.android.tools.build:gradle:8.0.0.     Required by:         project : > com.android.application:com.android.application.gradle.plugin:8.0.0         project : > com.android.library:com.android.library.gradle.plugin:8.0.0      > No matching variant of com.android.tools.build:gradle:8.0.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.0' but:          - Variant 'apiElements' capability com.android.tools.build:gradle:8.0.0 declares a library, packaged as a jar, and its dependencies declared externally:              - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8              - Other compatible attribute:                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.0')          - Variant 'javadocElements' capability com.android.tools.build:gradle:8.0.0 declares a component for use during runtime, and its dependencies declared externally:              - Incompatible because this component declares documentation and the consumer needed a library              - Other compatible attributes:                  - Doesn't say anything about its target Java version (required compatibility with Java 8)                  - Doesn't say anything about its elements (required them packaged as a jar)                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.0')

在这里插入图片描述

二、解决方案

原因:此为Android Studio默认的jdk版本与项目配置的Gradle所需的JDK不一致导致冲突所致。要求选择同一版本的JDK,可以选择Android Studio自带的jdk17。

解决方案:点击File -->Project Structure ->SDK Location->JDK location gradle Settings,将Gradle user home和项目的Gradle JDK改为一样的版本目录。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
然后点击Try Again,重新编译即可
在这里插入图片描述

来源地址:https://blog.csdn.net/Billy_Zuo/article/details/130730075

--结束END--

本文标题: Android Studio报错:Could not resolve com.android.tools.build:gradle:8.0.0

本文链接: https://lsjlt.com/news/372417.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作