当前位置:   article > 正文

鸿蒙+flutter 干货来咯!_flutter已经宣布兼容鸿蒙了

flutter已经宣布兼容鸿蒙了

好多人在纯撸鸿蒙,极少公司走鸿蒙+flutter的路线,你们想走这个路线的,我给你们趟坑了我做的时候是24年3月份,那会好多库 不支持,让给官方提供了一下我的项目里面的库,后来他们填完,基本一半 不支持,如今6月份了,适配的差不多了,flutter_flutter 也升级了,对应鸿蒙api12的 flutter版本也已经升级了。

如何在MacOS 上使用 Flutter 构建鸿蒙App

1、相关库主要是2个

Flutter 3.7.12 https://gitee.com/openharmony-sig/flutter_flutter

flutter 引擎 https://gitee.com/openharmony-sig/flutter_engine

2、环境相关配置

如何在MacOS 上使用 Flutter 构建鸿蒙App
看这个靠谱mac配置环境变量
如何windos上使用flutter 构建鸿蒙app
可以看看windos配置环境变量 (没验证哈,博主用的mac)

3、最后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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83

4、闲聊

博主第一次配置完成需要了3,4天,那个引擎产物有点复杂,各种环境,有的和版本有要求,一定要静下心来,配置过一次的就好 了,后面的同事可以复制粘贴了,加油兄弟们!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/900335
推荐阅读
相关标签
  

闽ICP备14008679号