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!!) {
相关推荐
problc6 小时前
Flutter中文字体设置指南:打造个性化的应用体验
android·javascript·flutter
lqj_本人15 小时前
鸿蒙next选择 Flutter 开发跨平台应用的原因
flutter·华为·harmonyos
lqj_本人18 小时前
Flutter&鸿蒙next 状态管理框架对比分析
flutter·华为·harmonyos
起司锅仔1 天前
Flutter启动流程(2)
flutter
hello world smile1 天前
最全的Flutter中pubspec.yaml及其yaml 语法的使用说明
android·前端·javascript·flutter·dart·yaml·pubspec.yaml
lqj_本人1 天前
Flutter 的 Widget 概述与常用 Widgets 与鸿蒙 Next 的对比
flutter·harmonyos
iFlyCai1 天前
极简实现酷炫动效:Flutter隐式动画指南第二篇之一些酷炫的隐式动画效果
flutter
lqj_本人1 天前
Flutter&鸿蒙next 中使用 MobX 进行状态管理
flutter·华为·harmonyos
lqj_本人1 天前
Flutter&鸿蒙next 中的 setState 使用场景与最佳实践
flutter·华为·harmonyos
hello world smile1 天前
Flutter常用命令整理
android·flutter·移动开发·android studio·安卓