错误描述
Flutter从3.10.1 升级到3.19.4,在3.10.1的时候一切运行正常,但是当我将Flutter版本升级到3.19.4后,出现了下方的错误
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':device_info_plus:compileDebugJavaWithJavac'.
> 错误: 无效的源发行版:17
* 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
解决办法
1. 下载java17
使用在Mac上安装多个Java版本 下载java17
2. 使用指令查看java的目录
/usr/libexec/java_home
3.在项目/android/gradle.properties中添加上一步获取到的路径
org.gradle.java.home=/Library/Java/JavaVirtualMachines/microsoft-17.jdk/Contents/Home