admin管理员组文章数量:1312692
I am trying to code Flutter in Visual Studio, and run the emulator, but every time I do, I get an error. From what I understand, it is asking me to update Java.
I updated Java to version 21, but the issue is still persisting!
How can I fix this?
This message appears
Could not run phased build action using connection to Gradle distribution `'.5-all.zip'`.
`.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'`.
Build file `'<your_project_path>/android/app/build.gradle' line: 2`
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin `'com.android.internal.application'`.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in `C:\Program Files\Java\jdk1.8.0_161\jre`
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `.gradle.java.home` in `gradle.properties`
I updated Java to version 21. and I expected the error to be resolved and the build to run successfully without issues.
I am trying to code Flutter in Visual Studio, and run the emulator, but every time I do, I get an error. From what I understand, it is asking me to update Java.
I updated Java to version 21, but the issue is still persisting!
How can I fix this?
This message appears
Could not run phased build action using connection to Gradle distribution `'https://services.gradle./distributions/gradle-7.5-all.zip'`.
`.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'`.
Build file `'<your_project_path>/android/app/build.gradle' line: 2`
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin `'com.android.internal.application'`.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in `C:\Program Files\Java\jdk1.8.0_161\jre`
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `.gradle.java.home` in `gradle.properties`
I updated Java to version 21. and I expected the error to be resolved and the build to run successfully without issues.
Share Improve this question edited Feb 1 at 11:09 Mark Rotteveel 109k229 gold badges156 silver badges220 bronze badges asked Feb 1 at 11:05 Hanady AlzhraniHanady Alzhrani 1 2 |1 Answer
Reset to default -1Try copying your flutter code to a new project check if it runs.
本文标签: flutterGradle not detecting Java 21 after update – how to fixStack Overflow
版权声明:本文标题:flutter - Gradle not detecting Java 21 after update – how to fix? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741878190a2402589.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
JAVA_HOME
environment variable is set toC:\Program Files\Java\jdk1.8.0_161\jre
, or you don't haveJAVA_HOME
set at all, andC:\Program Files\Java\jdk1.8.0_161\jre
is first on thePATH
. Set theJAVA_HOME
environment variable as the error suggests. – Mark Rotteveel Commented Feb 1 at 11:09