Environment Construction
1. Download Flutter SDK and configure environment variables
Harmony Flutter SDK needs to be downloaded from Gitee. It is currently recommended to download the dev branch code.
The following user variables need to be configured
Note that Harmony development requires the installation of Java and the configuration of related variables
# flutter sdk image
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
# pub image
PUB_HOSTED_URL=https://pub.flutter-io.cn
DEVECO_SDK_HOME=C:\Program Files\Huawei\DevEco Studio\sdk
# Java SDK
JAVA_HOME=C:\Program Files\Huawei\DevEco Studio\jbr
Configure environment variables
Edit PATH and add the following path. Harmony development requires the configuration of ohpm, hvigor and node
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
C:\Program Files\Huawei\DevEco Studio\jbr\bin
After the SDK is downloaded and the environment variables are configured properly, use flutter doctor to check whether each item is passed.
In the command line, run ohpm -v, hvigorw -v, node -v to check whether it can be used, and ensure that the PATH of each dependent tool is configured correctly.
Use echo %DEVECO_SDK_HOME%
, echo %JAVA_HOME%
and other commands to check whether user variables are effective.
When the environment variables change, you need to restart the command line tool.
In addition, it should be noted that user environment variables should be added first. If it is a system environment variable, you may need to log out or restart the system, otherwise the configuration may not take effect.
2. To avoid unexpected situations, use the same disk as the SDK for the new project location, such as D drive.
Otherwise, the package may not be found.
In addition, the project directory should not be too deep, otherwise the compilation may fail due to the long path.
3. VsCode cannot recognize the device
Open the project with DevEco. After the project analysis is completed, the device in Vscode should be available.
Top comments (0)