Preparation
Install DevEco Studio NEXT IDE, note that the version should be Next, the latest is Beta3
Install Git, if you want to adapt to Android at the same time, you need to install Android Studio; if you want to adapt to iOS, you need to install Xcode
Mac Installation (Recommended)
Environment Variable Configuration
# Flutter Mirror
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
# HarmonyOS SDK
export TOOL_HOME=/Applications/DevEco-Studio.app/Contents/
export DEVECO_SDK_HOME=$TOOL_HOME/sdk # command-line-tools/sdk
export PATH=$TOOL_HOME/tools/ohpm/bin:$PATH # command-line-tools/ohpm/bin
export PATH=$TOOL_HOME/tools/hvigor/bin:$PATH # command-line-tools/hvigor/bin
export PATH=$TOOL_HOME/tools/node/bin:$PATH # command-line-tools/tool/node/bin
Windows installation
Configure user variables
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
PUB_HOSTED_URL=https://pub.flutter-io.cn
DEVECO_SDK_HOME=C:\Program Files\Huawei\DevEco Studio\sdk
JAVA_HOME=C:\Program Files\Huawei\DevEco Studio\jbr
Configure environment variables
Edit PATH and add the following path
C:\Program Files\Huawei\DevEco Studio\tools\ohpm\bin
C:\Program Files\Huawei\DevEco Studio\tools\hvigor\bin
C:\Program Files\Huawei\DevEco Studio\tools\node
Manage multiple Flutter versions
If you need to use multiple Flutter versions in project development, you can consider using fvm
Install FVM
Use the official flutter version of fvm
fvm install 3.22.0
- Install a custom Harmony version and enter the fvm/version directory, which is usually located in the user directory, such as
~/fvm/versions/3.22.0
, Copy the repository and rename it tocustom_x.y.z
git clone -b dev https://gitee.com/openharmony-sig/flutter_flutter.git custom_3.7.12
- Use a separate flutter sdk version in the project, execute in the project directory:
fvm use custom_3.7.12
Common Problems
- Running flutter doctor shows
Error: Unable to find git in your PATH.
Execute the following command
git config --global --add safe.directory '*'
Cases
Flutter Harmony Exchange Group
[flutter Harmony Technology Exchange Group]
Currently Flutter HarmonyOS has been successfully implemented, but there are still some potential pitfalls that need to be solved and handled. Welcome to share and communicate with us
Please scan the code to add the assistant to join the group:
Remarks: HarmonyOS Flutter
wx: zacksleo
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.