Preparation
Install DevEco Studio NEXT IDE, note that the version should be Next, and the latest version 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 FilesHuaweiDevEco Studiosdk
JAVA_HOME=C:Program FilesHuaweiDevEco Studiojbr
Configure environment variables
Edit the PATH and add the following paths
C:Program FilesHuaweiDevEco Studiotoolsohpmbin
C:Program FilesHuaweiDevEco Studiotoolshvigorbin
C:Program FilesHuaweiDevEco Studiotoolsnode
C:Program FilesHuaweiDevEco Studiojbrbin
Manage multiple Flutter versions
If you need to use multiple versions of Flutter in your project development, you can consider using fvm
- Install FVM
- Use the official Flutter version of FVM
fvm install 3.22.0
- Install the custom HarmonyOS version and go to 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 to 'custom_x.y.z'
git clone -b dev https://gitcode.com/openharmony-sig/flutter_flutter.git custom_3.7.12
Note that the naming format must be 'custom_x.y.z', i.e. it must start with custom_ followed by a three-digit version number, e.g. 'custom_3.7.12'
- Use a separate version of the Flutter SDK in your project, executed in the project directory:
fvm use custom_3.7.12
Frequently Asked Questions
- Running flutter doctor gives 'Error: Unable to find git in your PATH.'
Execute the following command:
git config --global --add safe.directory '*'
Case
! alt text
Top comments (0)