HarmonyOS鸿蒙Next中Flutter警告正常吗

HarmonyOS鸿蒙Next中Flutter警告正常吗 运行flutter doctor --version 提示 Flutter 有警告,请问是否正常?flutter_flutter 目前已经是 3.22.0-ohos 分支

! Flutter version 3.22.1-ohos-1.0.5 on channel [user-branch] at /Users/blogbin/WorkSpaces/flutter_flutter Currently on an unknown channel. Run flutter channel to switch to an official channel. If that doesn’t fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Upstream repository https://gitcode.com/openharmony-tpc/flutter_flutter.git is not a standard remote. Set environment variable “FLUTTER_GIT_URL” to https://gitcode.com/openharmony-tpc/flutter_flutter.git to dismiss this error.

cke_2251.png

cke_2763.png


更多关于HarmonyOS鸿蒙Next中Flutter警告正常吗的实战教程也可以访问 https://www.itying.com/category-92-b0.html

3 回复

开发者您好,当前flutter环境处于非官方定制分支状态,属于正常现象,3.22.0-ohos是基于Openharmony定制的flutter分支,不属于flutter官方的标准渠道,flutter工具无法识别该分支的合法性,所以提示unknown channel

更多关于HarmonyOS鸿蒙Next中Flutter警告正常吗的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html


在HarmonyOS Next中使用Flutter时出现警告是正常现象。由于鸿蒙Next不再支持Android生态,Flutter框架依赖的Skia图形引擎和Dart虚拟机可能与鸿蒙原生运行时存在兼容性差异。这些警告通常涉及API调用、渲染机制或平台通道通信的适配问题。华为官方已明确鸿蒙Next将聚焦原生应用开发,建议关注ArkTS/ArkUI替代方案。当前Flutter在鸿蒙Next的兼容性支持尚不完善,部分功能可能受限。

在HarmonyOS Next环境下使用Flutter时出现警告是正常现象。根据您提供的信息,主要存在两个警告:

  1. 未知分支警告:由于您使用的是OpenHarmony TPC维护的Flutter分支(3.22.0-ohos),而非官方标准分支,Flutter工具会提示"Currently on an unknown channel"。这是预期行为,不影响实际开发功能。

  2. 非标准远程仓库警告:Flutter检测到当前使用的git远程仓库(https://gitcode.com/openharmony-tpc/flutter_flutter.git)不是官方仓库,因此提示"is not a standard remote"。这是OpenHarmony适配分支的正常提示。

解决方案

  • 按照提示设置环境变量即可消除警告:
    export FLUTTER_GIT_URL="https://gitcode.com/openharmony-tpc/flutter_flutter.git"
    
  • 或将其添加到shell配置文件中永久生效

这些警告仅表示您在使用针对HarmonyOS优化的Flutter分支,不会影响应用的编译和运行。只要Flutter doctor显示其他项目(如Dart SDK、设备连接等)正常,即可继续开发。

回到顶部