Flutter:Android Gradle插件需要Java 17才能运行,您当前使用的是Java 11

v1uwarro  于 5个月前  发布在  Java
关注(0)|答案(1)|浏览(178)

我一直在尝试将flutter_stripe软件包升级到10.0.0版本,它需要gradle 8.0 0r更高.
下面是我调试控制台的样子:

Launching lib\main.dart on 21121119SG in debug mode...

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\morsv\Documents\Flutter Projects\book_door\android\app\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
      Your current JDK is located in C:\Program Files\Android\Android Studio\jre
      You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1

Exited (1).

字符串
我尝试在IDE设置中更改java版本,尝试将java 17添加到我的环境变量中,并尝试编辑gradle.properties文件,但没有任何工作.我做错了什么吗?(我正在使用vscode btw是否有特殊的方法来更改vscode的jdk?)

qv7cva1a

qv7cva1a1#

正在构建中。gradle
变化

compileOptions {
   sourceCompatibility = JavaVersion.VERSION_11
   targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
        jvmTarget = '11' 
    }

字符串

compileOptions {
   sourceCompatibility = JavaVersion.VERSION_17
   targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
        jvmTarget = '17' 
    }


尝试更新gradle如果不工作

相关问题