Flutter 错误集合

编译工程时 One or more plugins require a higher Android NDK version.Fix this issue by adding the following to

大概意思:需要更高的Android NDK版本(比27.0.12077973更高的ndk版本)

解决方案

通过 SDK Tools 下载 对应版本的 ndk 文件

配置ndk路径

修改 flutter ndkVersion

major version (Mac电脑)

BuildScript Unsupported class file major version 65

表示你尝试运行一个使用了Java 19(Java SE 19的类文件主要版本号为65)编译的类文件,但在一个不支持该版本的Java虚拟机(JVM)上运行。

解决方案

通过gradle.properties 文件配置 jdk的安装路径

flutter this and base files have different roots (Windows11电脑)

大概意思就是:对应的依赖位置和项目编译后位置不一致导致

解决方案

添加 环境变量 PUB_CACHE 位置和项目同一个磁盘即可

设置完环境变量(最好重启一下电脑)
关闭 Android Studio,打开dos窗口(cmd),进入项目根目录(我没重启是这么执行的,不然在Studio Studio里面执行命令依赖位置还在原来文件里)分别执行如下命令

复制代码
flutter clean
arduino 复制代码
flutter pub get

执行完命令后,进到 android目录,执行如下命令:

bash 复制代码
./gradlew clean
bash 复制代码
./gradlew build

Some Android licenses not accepted (Windows11电脑)

大概意思就是:Android工具链-为Android设备开发(Android SDK版本35.0.1) ! 一些Android许可证不被接受。要解决这个问题,运行:flutter doctor -android-licenses

解决方案

执行如下命令

css 复制代码
flutter doctor --android-licenses

执行如下命令:

复制代码
flutter doctor

Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable (Windows11电脑)

解决方案

下载谷歌浏览器 并安装

执行如下命令

复制代码
flutter doctor

Visual Studio not installed; this is necessary to develop Windows apps. (Windows11电脑)

解决方案

下载并安装visualstudio

出现如下错误:

Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:

解决方案

执行如下命令

复制代码
flutter doctor

编译Android+Flutter混合工程 Task:flutter:copyFlutterAssetsRelease (Windows电脑)

解决方案

修改 flutter sdk 下面的flutter.groovy 文件

相关推荐
AsiaLYF1 小时前
kotlin中MutableStateFlow和MutableSharedFlow的区别是什么?
android·开发语言·kotlin
2501_916008891 小时前
iOS 发布全流程详解,从开发到上架的流程与跨平台使用 开心上架 发布实战
android·macos·ios·小程序·uni-app·cocoa·iphone
4Forsee1 小时前
【Android】浅析 Android 的 IPC 跨进程通信机制
android·java
叶羽西2 小时前
如何区分Android、Android Automotive、Android Auto
android
用户2018792831672 小时前
用 “奶茶店订单系统” 讲懂 MVI 架构
android
LiuYaoheng2 小时前
【Android】布局优化:include、merge、ViewStub的使用及注意事项
android·java
未来猫咪花3 小时前
Riverpod 3.0:一个过度设计的反面教材
flutter
Kapaseker3 小时前
Kotlin Flow 的 emit 和 tryEmit 有什么区别
android·kotlin
消失的旧时光-19434 小时前
Flutter 并发编程全解:从零掌握 Isolate
flutter
好好学习啊天天向上4 小时前
Android Studio 撕开安卓手机投屏
android·智能手机·android studio