Flutter:使用connectivity_plus包时出现“无效源版本:17”错误

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

尝试使用

connectivity_plus
包进行编译时,我在 Flutter 项目中遇到错误。我收到的错误消息是:

FAILURE: Build failed with an exception.

* What went wrong:
> error: invalid source release: 17

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --scan to get full insights.

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

我尝试过:

  • 扑扑干净
  • 设置java_home

当前的java版本是

18.0.2.1

flutter dart sdk flutter-dependencies
1个回答
0
投票

早些时候我也遇到了同样的错误。我使用的是 Android Studio(电鳗)。当我转到“帮助 -> 关于”时,我看到运行时版本是 11。这对我有用:

  1. 我从这个网站下载了最新的Android Studio(Iguana):https://developer.android.com/studio/intro?utm_source=android-studio
  2. 现在在 Android Studio (Iguana) 中,转到“帮助 -> 关于”,看到的运行时版本将为 17,如下所示:Runtime version is observed to be 17.0.9+ to be exact (this link contains the screenshot)

3.之后,我只是通过 VS code 运行我的 flutter 应用程序,它成功了!希望上述解决方案也适用于您:)。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.