android 无法使用与Gradle分发版本“https://services.gradle.org/distributions/gradle-7.4-all.zip”的连接运行分阶段构建操作

7kqas0il  于 2023-02-06  发布在  Android
关注(0)|答案(1)|浏览(403)

有人能帮我解决这个错误吗

Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.4-all.zip'.
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'android'.
A problem occurred configuring root project 'android'.
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
A problem occurred evaluating project ':app'.
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
  - changing the IDE settings.
  - changing the JAVA_HOME environment variable.
jv4diomz

jv4diomz1#

    • 1-更新分级:**

从以下网址获取Android Studio支持的最新版本:
https://services.gradle.org/distributions

    • 2-将Android项目升级到Java 11:**
android {
    .
    .
    .
    compileOptions {
      sourceCompatibility JavaVersion.VERSION_11
      targetCompatibility JavaVersion.VERSION_11
    }

    // For Kotlin projects
    kotlinOptions {
      jvmTarget = "11"
    }
}

转到首选项→构建、执行、部署→构建工具→ Gradle → * Gradle JDK。

    • 3同步项目:**
  • 同步项目
  • 清洁项目
  • 重建项目

就是这样。

相关问题