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!!) {
相关推荐
sun_weitao17 小时前
Flutter路由动画Hero函数的使用
java·服务器·flutter
ChinaDragonDreamer19 小时前
Flutter:使用FVM安装多个Flutter SDK 版本和使用教程
flutter·鸿蒙
GY-9319 小时前
Flutter项目适配鸿蒙
flutter·harmonyos
sun_weitao19 小时前
Flutter使用BorderRadiusTween实现由矩形变成圆形的动画
flutter
唯一的wataru1 天前
【Flutter多语言翻译】一句话翻译返回多个widget
flutter
2401_897444642 天前
用AI技术提升Flutter开发效率:ScriptEcho的力量
前端·人工智能·flutter
程序猿000001号2 天前
Vue.js 中父组件与子组件通信指南
前端·vue.js·flutter
Bonway_Huang2 天前
Mac 端 VSCode Flutter 快捷键大全
vscode·flutter·macos
lichong9512 天前
【Flutter&Dart】tolyui_feedback组件例子效果(23 /100)
android·flutter·api·postman·tooltip·smartapi
lichong9513 天前
【Flutter&Dart】 listView.builder例子二(14 /100)
android·javascript·flutter·api·postman·postapi·foxapi