androidStudio升级2022.2.1 Patch 1后flutter改成无法编译

2023-05-16

报错如下: 

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\GitHub\law_train_app\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 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.
       - 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 4s
Running Gradle task 'assembleDebug'...                              4.5s

┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] You need Java 11 or higher to build your app with this version of Gradle.                                   │
│                                                                                                                 │
│ To get Java 11, update to the latest version of Android Studio on https://developer.android.com/studio/install. │
│                                                                                                                 │
│ To check the Java version used by Flutter, run `flutter doctor -v`.                                             │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1

并且修改gradle JDK没有效果。

解决方法:

查看<Android studio install folder>/jre目录下是否为空,如果为空

执行如下命令

C:\Program Files\Android\Android Studio>rmdir /s .\jre
.\jre, 是否确认(Y/N)? y

C:\Program Files\Android\Android Studio>mklink /D .\jre .\jbr
为 .\jre <<===>> .\jbr 创建的符号链接

执行好如下:

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

androidStudio升级2022.2.1 Patch 1后flutter改成无法编译 的相关文章

随机推荐