赞
踩
好多人在纯撸鸿蒙,极少公司走鸿蒙+flutter的路线,你们想走这个路线的,我给你们趟坑了我做的时候是24年3月份,那会好多库 不支持,让给官方提供了一下我的项目里面的库,后来他们填完,基本一半 不支持,如今6月份了,适配的差不多了,flutter_flutter 也升级了,对应鸿蒙api12的 flutter版本也已经升级了。
如何在MacOS 上使用 Flutter 构建鸿蒙App
Flutter 3.7.12 https://gitee.com/openharmony-sig/flutter_flutter
flutter 引擎 https://gitee.com/openharmony-sig/flutter_engine
如何在MacOS 上使用 Flutter 构建鸿蒙App
看这个靠谱mac配置环境变量
如何windos上使用flutter 构建鸿蒙app
可以看看windos配置环境变量 (没验证哈,博主用的mac)
open ~/.zshrc 打开配置页面
下面是我的flutter +鸿蒙相关的 配置信息
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # HomeBrew export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles export PATH="/usr/local/bin:$PATH" export PATH="/usr/local/sbin:$PATH" eval "$(/opt/homebrew/bin/brew shellenv)" # HomeBrew END #JAVA export PATH="$HOME/.jenv/bin:$PATH" eval "$(jenv init -)" #Python3 export PATH="/opt/homebrew/opt/python@3.8/libexec/bin:$PATH" # Node配置 export NODE_HOME="/Users/xxxx/.nvm/versions/node/v18.19.1" ###################################################################################################################### # Flutter 镜像配置 export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn # Flutter 配置 #export FLUTTER=/opt/flutter/bin export FLUTTER=/Users/xxxx/ohos/flutter_flutter/bin export PATH=$FLUTTER:$PATH # Harmony flutter export PUB_HOSTED_URL=https://pub.dev export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn #export FLUTTER_GIT_URL=OpenHarmony-SIG/flutter_flutter export FLUTTER_GIT_URL=https://gitee.com/openharmony-sig/flutter_flutter.git # MAVEN export MAVEN_HOME=/Users/xxxx/ohos/tools/apache-maven-3.9.6 export PATH=$PATH:$MAVEN_HOME/bin #Dart配置 export PATH=$PATH:/Users/xxxx/ohos/flutter_flutter/bin/cache/dart-sdk/bin # Open Harmony 配置 export OHPM_HOME=/Users/xxxx/ohos/tools/oh-command-line-tools/ohpm export PATH=$PATH:$OHPM_HOME/bin export PATH=$PATH:/Users/xxxx/ohos/tools/oh-command-line-tools/sdkmanager/bin #export OHOS_SDK_HOME=/Users/xxxx/ohos/OpenHarmony/Sdk/11 export OHOS_SDK_HOME=/Users/xxxx/ohos/OpenHarmony/Sdk/12 export OHOS_NDK_HOME=$OHOS_SDK_HOME/native export PATH=$PATH:$OHOS_NDK_HOME # Harmony配置 export HOS_SDK_HOME=/Users/xxxx/ohos/Huawei/Sdk #export PATH=$PATH:$HOS_SDK_HOME export HPM_HOME=/Users/xxxx/ohos/tools/command-line-tools/ohpm export PATH=$PATH:$HPM_HOME/bin #export PATH=$PATH:/Users/xxxx/ohos/tools/command-line-tools/sdkmanager/bin export PATH=$PATH:/Users/xxxx/ohos/tools/command-line-tools/bin #HDC工具环境变量 export HDC_HOME=/Users/xxxx/ohos/Huawei/Sdk/HarmonyOS-NEXT-DB1/hms/toolchains #export HDC_HOME=/Users/xxxx/ohos/Huawei/Sdk/HarmonyOS-NEXT-DP2/base/toolchains export PATH=$PATH:$HDC_HOME #签名工具 export SIGN_TOOL_HOME=/Users/xxxx/ohos/tools/developtools_hapsigner/hapsigntool/hap_sign_tool/target
博主第一次配置完成需要了3,4天,那个引擎产物有点复杂,各种环境,有的和版本有要求,一定要静下心来,配置过一次的就好 了,后面的同事可以复制粘贴了,加油兄弟们!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。