HarmonyOS鸿蒙Next中TextInputPlugin ets转换异常
HarmonyOS鸿蒙Next中TextInputPlugin ets转换异常
flutter_flutter 版本3.22-1.0.1
DevEco Studio 5.0.1 Release Build Version: 5.0.5.315, built on January 3, 2025
在进行构建时,插件转换有异常
hvigor ERROR: Failed :file_selector_ohos:default@HarCompileArkTS…
hvigor ERROR: ArkTS Compiler Error
1 ERROR: ArkTS:ERROR File: /xxxx/ohos/oh_modules/.ohpm/@ohos+flutter_ohos@9kqpxxvrkevrqywwhtpiewkd1pgqyw5lf7dxvh2sbiq=/oh_modules/@ohos/flutter_ohos/src/main/ets/plugin/editing/TextInputPlugin.ets:232:36
更多关于HarmonyOS鸿蒙Next中TextInputPlugin ets转换异常的实战教程也可以访问 https://www.itying.com/category-93-b0.html
从错误信息来看,这是 TextInputPlugin.ets
文件在 ArkTS 编译时出现的类型转换问题。具体表现为:
-
错误发生在
TextInputPlugin.ets
文件的 232 行,类型TextInputClient
无法转换为number
类型。 -
从截图看,问题出在 Flutter 插件与 HarmonyOS 的适配层,可能原因是:
- Flutter 侧与 HarmonyOS 侧对
TextInputClient
的类型定义不一致。 - 插件转换过程中类型映射出现偏差。
建议检查:
- 确认
flutter_ohos
插件版本是否与 Flutter SDK 版本匹配。 - 查看
TextInputClient
在 Flutter 侧和 HarmonyOS 侧的类型定义差异。 - 检查插件转换配置是否正确。
这类问题通常需要调整插件适配层的类型转换逻辑,或者等待插件提供方更新兼容版本。