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!!) {
相关推荐
小蜜蜂嗡嗡6 小时前
flutter image_cropper截图控件布局顶到状态栏中问题
flutter
程序员老刘11 小时前
跨平台开发地图:大厂统一底层,五月框架大乱斗谁在干实事?| 2026年5月
flutter·客户端
环信即时通讯云13 小时前
环信Flutter UIKit适配鸿蒙实战指南
flutter·华为·harmonyos
用户5368221001815 小时前
flutter学习笔记 - Dart基本语法(一)
flutter
用户游民16 小时前
Flutter Provider原理以及用法
前端·flutter
qq_140303414418 小时前
flutter
flutter
程序员老刘1 天前
为什么AI不会淘汰Flutter,反而让它更吃香了
flutter·ai编程·客户端
蝎子莱莱爱打怪1 天前
我花两年业余时间做了个IM系统,然后呢😂??
后端·flutter·面试
Swuagg2 天前
Flutter EventBus 架构设计:基于 Stream 的事件总线实现与实践
flutter·eventbus·事件总线