Execution failed for task ‘:keyboard_utils:compileDebugKotlin‘.

Execution failed for task ':keyboard_utils:compileDebugKotlin'.

这个错误是keyboard_utils依赖报错。

这个问题在keyboard_utils github项目的issues 有记载Project does not run with new Flutter 2.10.0

详细错误信息:

typescript 复制代码
e: /Users/andreifufylev/development/flutter/.pub-cache/hosted/pub.dartlang.org/keyboard_utils-1.3.3/android/src/main/kotlin/br/com/keyboard_utils/manager/KeyboardUtils.kt: (56, 40): Using 'max(): T?' is an error. Use maxOrNull instead.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':keyboard_utils:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 24s
Exception: Gradle task assembleDevelopmentDebug failed with exit code 1

解决方式:

1.建议使用1.3.4版本。

2.从写该依赖的handleKeyboard()方法:

typescript 复制代码
override fun handleKeyboard() {
        keyboardSessionTimer = object : CountDownTimer(150, 1) {
            override fun onFinish() {
                keyboardSessionHeights.maxOrNull().let {
                    if (it!! > 0 && lastKeyboardHeight!! != it!!) {
相关推荐
QQ129584550416 小时前
错误解决:Flutter找不到合适的Visual Studio 工具链
flutter·visual studio
程序员老刘17 小时前
Flutter版本选择指南:避坑3.27 | 2025年9月
flutter·客户端
清风细雨_林木木21 小时前
flutter 里面的渐变色设置
前端·flutter
猪哥帅过吴彦祖21 小时前
Flutter 系列教程:布局基础 (下) - Stack 绝对定位和 Expanded 弹性布局
前端·flutter·ios
小林的技术分享1 天前
Flutter 创建一个插件(FFI)
flutter
木易 士心1 天前
Flutter - dart 语言从入门到精通
flutter
文阿花2 天前
flutter 3.22+ Android集成高德Flutter地图自定义Marker显示
android·flutter
猪哥帅过吴彦祖2 天前
Flutter 系列教程:布局基础 (上) - `Container`, `Row`, `Column`, `Flex`
前端·flutter·ios
星海浮沉2 天前
flutter AudioPlayer的使用问题及处理
flutter
-晨-风-2 天前
Flutter 运行IOS真机,提示无法打开“****”
flutter·ios