Flutter开发HarmonyOS鸿蒙Next应用的时候flutter create --platforms ohos失败如何解决
Flutter开发HarmonyOS鸿蒙Next应用的时候flutter create --platforms ohos失败如何解决
【模块名_概率】简要描述:
【环境信息】: Flutter doctor -v:
$ flutter doctor -v Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! [√] Flutter (Channel dev, 3.7.12-ohos-1.0.0, on Microsoft Windows [版本 10.0.19044.1526], locale zh-CN) • Flutter version 3.7.12-ohos-1.0.0 on channel dev at C:\hmsdk\flutter_flutter • Upstream repository https://gitee.com/openharmony-sig/flutter_flutter.git • FLUTTER_GIT_URL = https://gitee.com/openharmony-sig/flutter_flutter.git • Framework revision cf658a56de (8 weeks ago), 2024-10-23 01:32:11 +0000 • Engine revision 1a65d409c7 • Dart version 2.19.6 • DevTools version 2.20.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn
G[☠] HarmonyOS toolchain - develop for HarmonyOS devices (the doctor check crashed) X Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues. X Exception: HarmonyOS toolchain - develop for HarmonyOS devices exceeded maximum allowed duration of 0:04:30.000000 •
[X] Windows Version (Unable to confirm if installed Windows version is 10 or greater)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at D:\dev_tools\android-sdk
X cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run flutter doctor --android-licenses
to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[X] Visual Studio - develop for Windows X Visual Studio not installed; this is necessary for Windows development. Download at https://visualstudio.microsoft.com/downloads/. Please install the “Desktop development with C++” workload, including all of its default components
[√] Android Studio (version 2021.2) • Android Studio at D:\dev_tools\android-studio-2021.2.1.16-windows\android-studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[!] Android Studio (version 2024.1) • Android Studio at D:\dev_tools\AndroidStudio240101 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart X Unable to find bundled Java version. • Try updating or re-installing Android Studio.
[√] Android Studio (version 2021.1) • Android Studio at D:\dev_tools\android-studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] Connected device (1 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19044.1526] ! Device 3bee2980 is not authorized. You might need to check your device for an authorization dialog.
[√] HTTP Host Availability • All required HTTP hosts are available
! Doctor found issues in 5 categories.
【预置条件】:
【测试步骤】:
【预期结果】: 希望flutter create 成功创建flutter工程
【实际结果】:
$ flutter create --platforms ohos aptest Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Creating project aptest… Running “flutter pub get” in aptest… Could not find a file named “pubspec.yaml” in “C:\hmsdk\workspace\aptest”. pub get failed command: “C:\hmsdk\flutter_flutter\bin\cache\dart-sdk\bin\dart __deprecated_pub --directory aptest get --example” pub env: { “FLUTTER_ROOT”: “C:\hmsdk\flutter_flutter”, “PUB_ENVIRONMENT”: “flutter_cli:create”, “PUB_CACHE”: “C:/PUB”, } exit code: 66
【恢复手段】:
【出现概率】:问题出现次数/实际测试次数 必现
【定位信息】:
-
- Log、截图、多媒体文件等,所有和问题有关的信息:
更多关于Flutter开发HarmonyOS鸿蒙Next应用的时候flutter create --platforms ohos失败如何解决的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
在Flutter开发HarmonyOS(鸿蒙)Next应用时,遇到flutter create --platforms ohos
命令失败的问题,通常可能是由于以下几个原因:
-
Flutter与HarmonyOS SDK版本不兼容:确保你的Flutter SDK以及HarmonyOS SDK都已更新到支持相互集成的最新版本。
-
环境配置问题:检查环境变量是否正确设置,特别是鸿蒙开发环境的路径和依赖库是否配置正确。
-
插件或依赖项缺失:某些必要的插件或依赖项可能未正确安装或配置,这会导致创建命令失败。
-
权限问题:确保你有足够的权限来执行该命令,特别是在涉及系统级安装或配置时。
-
网络问题:如果命令需要从外部服务器下载数据或资源,确保你的网络连接稳定。
解决这类问题的一般步骤包括:
- 确认所有相关软件(Flutter、Dart、HarmonyOS SDK)均为最新版本。
- 仔细检查并更新环境变量设置。
- 验证所有依赖项和插件是否已正确安装。
- 以管理员权限运行命令提示符或终端。
- 检查网络连接,必要时使用可靠的VPN。
如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html
更多关于Flutter开发HarmonyOS鸿蒙Next应用的时候flutter create --platforms ohos失败如何解决的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html