新建一个工程,执行Sync gradle files报错,提示Gradle plugin找不到或者运行库版本不兼容,会有不同的错误提示。摘录部分错误提示如下。
解决方法:需要使用JDK 11编译工程。
设置步骤:

  1. File -> Project Structure -> SDK Location
  2. Gradle Settings -> Gradle projects -> Gradle JDK,在下拉列表中选择JDK 11版本,如果没有可以在下拉列表中选择菜单项“Download JDK”,选择需要的版本即可。
    在这里插入图片描述
    在这里插入图片描述

Could not resolve all files for configuration ‘:classpath’.
Could not resolve com.android.tools.build:gradle:7.4.0-rc03.
Required by:
project : > com.android.application:com.android.application.gradle.plugin:7.4.0-rc03
project : > com.android.library:com.android.library.gradle.plugin:7.4.0-rc03
No matching variant of com.android.tools.build:gradle:7.4.0-rc03 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.gradle.plugin.api-version’ with value ‘7.5’ but:
- Variant ‘apiElements’ capability com.android.tools.build:gradle:7.4.0-rc03 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5’)
- Variant ‘javadocElements’ capability com.android.tools.build:gradle:7.4.0-rc03 declares a runtime of a component, 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 ‘7.5’)
- Variant ‘runtimeElements’ capability com.android.tools.build:gradle:7.4.0-rc03 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5’)
- Variant ‘sourcesElements’ capability com.android.tools.build:gradle:7.4.0-rc03 declares a runtime of a component, 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 ‘7.5’)

目前我遇到的关于 Gradle 报错 一般分为两种形式: Error:Could not download gradle -core.jar (com. android .tools.build: gradle -cor......... ② Error:
Android Studio El ect ric Eel 2022.1.1 Canary 2( android - studio -2022.1.1.2-windows.zip) 适用于Windows x86_64系统。 Android Studio 版本排序: El ect ric Eel | 2022.1.1 Dolphin | 2021.3.1 Chipmunk | 2021.2.1 Bumblebee | 2021.1.1 Arctic Fox | 2020.3.1 Android studio 4.2.2
Android Studio El ect ric Eel 2022.1.1 Canary 2( android - studio -2022.1.1.2-mac.zip) 适用于macOS Int el 系统,文件使用WinRAR分割两个压缩包,必须一起下载使用。在macOS使用WinZip进行解压: Android Studio El ect ric Eel android - studio -2022.1.1.2-mac.part1) https://download.csdn.net/download/weixin_43800734/85486260 Android Studio El ect ric Eel android - studio -2022.1.1.2-mac.part2) https://download.csdn.net/download/weixin_43800734/85486263 Android Studio 排序: El ect ric Eel | 2022.1.1 Dolphin | 2021.3.1 Chipmunk | 2021.2.1 Bumblebee | 2021.1.1
A problem occurred configuring root proj ect 'DataBinding'. > Could not resolve all files for configuration ':classpath'. > Could not resolve com. android .tools.build: gradle :7.4.2.
Android Studio El ect ric Eel 2022.1.1 Canary 2( android - studio -2022.1.1.2-linux.tar.gz) 适用于Linux x86_64系统。 Android Studio 版本排序: El ect ric Eel | 2022.1.1 Dolphin | 2021.3.1 Chipmunk | 2021.2.1 Bumblebee | 2021.1.1 Arctic Fox | 2020.3.1 Android studio 4.2.2
解决 Android Studio El ect ric Eel | 2022.1.1无法使用lombok或使用魔改后的lombok后编辑器出现不 提示 bug 请下载该压缩包,解压后放到 android studio 安装目录下的plugins目录中 例如: C:\Program Files\ Android \ Android Studio \plugins\ 然后重启一下 Android Studio 就可以愉快的玩耍了 ~ Nice ~