Location>code7788 >text

Hongmeng Flutter Hands-on: 01-Build Development Environment

Popularity:730 ℃/2024-10-21 14:55:30

Hongmeng Flutter Hands-on: 01-Build Development Environment

preliminary

1. InstallationDevEco Studio NEXT IDE, note that the version should be Next, the latest is Beta3.

2. install Git, if you want to adapt to Android, 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=
export FLUTTER_STORAGE_BASE_URL=

# HarmonyOS SDK
export TOOL_HOME=/Applications//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

Configuring user variables

FLUTTER_STORAGE_BASE_URL=

PUB_HOSTED_URL=

DEVECO_SDK_HOME=C:\Program Files\Huawei\DevEco Studio\sdk

JAVA_HOME=C:\Program Files\Huawei\DevEco Studio\jbr

Configuring Environment Variables

Edit the 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

Managing Multiple Flutter Versions

If you need to use more than one version of Flutter for your project, consider using the fvm

  1. mountingFVM
  2. Using the official flutter version of fvm
fvm install 3.22.0

```bash
3. To install a customized version of fvm, go to the fvm/version directory, which is usually located in the user directory, e.g. `~/fvm/versions/3.22.0`, copy the repository and rename it to the name `custom_x.`.
Copy the repository and rename it to something like `custom_x.`.

``bash
git clone -b dev /openharmony-sig/flutter_flutter.git custom_3.7.12
  1. Use a separate version of the flutter sdk in your project, executed in the project directory:
fvm use custom_3.7.12

common problems

  1. Running flutter doctor brings up theError: Unable to find git in your PATH.

Execute the following command

git config --global --add  '*'

case (law)

  • Webview Integration

Flutter Hongmeng Exchange Group

[flutter hongmeng technical exchange group]

Currently Flutter honk has been run through, but there are still some potential pitfalls need to be solved and dealt with, welcome to share and exchange!

Please add a small assistant to the group:
Remarks: Hongmeng Flutter
wx:zacksleo

bibliography

  • Flutter Chinese Documentation
  • Harmonyos Next Development Documentation