运行简单的新建Flutter App项目出现异常

问题描述 投票:0回答:1

我创建了一个新的 Flutter 应用程序,只是为了在我的设备上试用该应用程序。但它给出了以下错误。

Build file 'D:\sample_projects\we_connect\android\app\build.gradle' line: 2

An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > Could not create an instance of type com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated.
      > Could not create an instance of type com.android.build.gradle.internal.dsl.LintImpl$AgpDecorated.
         > Could not generate a decorated class for type LintImpl$AgpDecorated.
            > com/android/tools/lint/model/LintModelSeverity has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

* Try:
> 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.
.
.
.
.
.
.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

我已经搜索过这个问题并尝试了一些解决方案,但到目前为止没有任何效果。 有人请帮帮我吗

我尝试将 Gradle JDL 更改为版本 11。 我还将 gradle 升级到最新版本 8.10.1 并更新 gradle-wrapper.properties。

flutter dart gradle build.gradle
1个回答
0
投票

该错误与 Java 最相关:“版本 55”意味着您使用的是 Java 版本 11,而 gradle 是使用 Java 版本 17(提到的“61”版本)编译的。您需要了解如何升级 gradle 正在使用的 Java 版本。

© www.soinside.com 2019 - 2024. All rights reserved.