Software installation

Download and install Node.js

  1. Log in to the official website of Node.js and download the Node.js software package. Select a software package corresponding to the LTS version and Windows 64-bit
    • Nodejs.org/en/download…
  2. Click the downloaded software package to install, Next, until Finish; During the installation, node.js automatically configures the directory path of node.exe in the path environment variable.
  3. After the installation, open the cli tool and run the node -v command to check the version information.

Download and install DevEco Studio

  1. Go to the HUAWEI DevEco Studio product page and download the DevEco Studio installation package. (Login/developer account required)
    • Developer.harmonyos.com/cn/develop/…
  2. Double-click devEco studio Launcher to go to the DevEco Studio installation wizard. On the installation options screen, select DevEco Studio Launcher and click Next to complete the installation.
  3. After the installation is complete, do not select Run DevEco Studio. Then check and configure the development environment according to the configuration requirements.

Configuring the development Environment

Setting the proxy (not mandatory)

Set the NPM agent

  • Prerequisite: No configuration is required for HarmonyOS applications only if the network does not have direct access to the Internet & the JS language is required to develop HarmonyOS applications
1. Set the proxy // If authentication is required for the proxyserver NPM config set proxy http://user:password @proxyServer :port NPM config set HTTPS -proxy http://user:password@proxyserver:port // If the proxyserver to be used does not require authentication (no account and password are required) NPM config set proxy http://proxyserver:port NPM config set https-proxy http://proxyserver:port 2. 3. Set up the NPM repository (in order to improve the JS SDK download, Use NPM to install JS depend on the speed of) NPM config set registry at https://mirrors.huaweicloud.com/repository/npm/Copy the code

Set the Gradle agent

  • Prerequisite: This configuration is required only when the network cannot directly access the Internet
  1. Open “This computer”, in the folder address bar, enter % userProfile % (Mac system, please click go > Personal), enter the personal user interface.
  2. Create a folder named.gradle. If you already have a. Gradle folder, skip this operation.
  3. Go to the. Gradle folder, create a new text document, name it Gradle, and change the suffix to.properties.
  4. Open gradle.properties file, add the following script, and save it
systemProp.http.proxyHost=proxy.server.com
systemProp.http.proxyPort=8080
systemProp.http.nonProxyHosts=*.company.com|10.*|100.*
systemProp.http.proxyUser=userId
systemProp.http.proxyPassword=password
systemProp.https.proxyHost=proxy.server.com
systemProp.https.proxyPort=8080
systemProp.https.nonProxyHosts=*.company.com|10.*|100.*
systemProp.https.proxyUser=userId
systemProp.https.proxyPassword=password
Copy the code

Set up the DevEco Studio agent

  • Prerequisite: This configuration is required only when the network cannot directly access the Internet
  1. Run the installed DevEco Studio. For the first time, select Do not Import Settings and click OK.
  2. Following the instructions on the DevEco Studio welcome screen, click Setup Proxy, Or click Configure > Settings > Appearance & Behavior > System Settings > HTTP Proxy on the welcome page. Preferences > Appearance & Behavior > System Settings > HTTP Proxy);
  3. Example Set HTTP Proxy information for DevEco Studio.
  4. After the configuration is complete, click Check Connection and enter a network address such as developer.harmonyos.com to Check the network connectivity. If Connection successful is displayed, the agent is successfully set.
  5. Click the OK button to complete the DevEco Studio agent configuration.

Download HarmonyOS SDK

  • Once the DevEco Studio agent is set up, you will be prompted to install the HarmonyOS SDK, which can be downloaded to the default directory by clicking Next. If you want to change the directory where the SDK is stored, click Cancel and follow the steps below.
  1. On the menu bar, click Configure > Settings or Ctrl+Alt+S (Configure > Preferences for Mac systems, Command+,) to open the Settings configuration screen.
  2. Go to the Appearance & Behavior > System Settings > HarmonyOS SDK menu and click the Edit button to set the path for storing the HarmonyOS SDK.
  3. Select the HarmonyOS SDK storage path and click Next to download the latest Java SDK and Toolchains by default. In the License Agreement window that pops up, click Accept to start downloading the SDK.
  4. Click Finish. You can see that the default SDK Platforms > Java and SDK Tools > Toolchains have been downloaded.
  5. If the project will also use JS or C/C++ language, please select the corresponding SDK package in SDK Platform and click Apply. SDK Manager will automatically download the SDK package and tool chain to the SDK storage path set in 3.

Run HelloHarmony

  1. Open DevEco Studio and click Create HarmonyOS Project on the welcome page to Create a new Project.
  2. Select the device type and template. Take Phone as an example, select Empty Feature Ability(Java) and click Next.
  3. Fill in the project information, keep the default values, and click Finish.
  4. When a project is created, DevEco Studio will automatically synchronize the project. When the project is created for the first time, the Gradle tool will be downloaded automatically.
  5. In the DevEco Studio menu bar, click Tools > HVD Manager. To use the emulator for the first time, download the emulator related resources. Click OK. After the resources are downloaded, click Tools > HVD Manager again.
  6. The huawei Developer Union account login page is displayed in the browser. Enter the user name and password of the huawei Developer Union account with real name authentication to log in.
  7. After login, please click the “Allow” button on the interface to authorize.
  8. In the device list, select Phone device and run emulator.
  9. Click the Run button in the DevEco Studio toolbar to run the project, or use the default shortcut Shift+F10 (Control+R for Mac) to run the project.
  10. In the Select Deployment Target screen that pops up, Select the simulator that has been started and click OK.
  11. DevEco Studio starts compiling and building the application, and when it’s finished, the application runs on the emulator.

I am Jinyang, if you want to advance and learn more about dry goods, welcome to follow the wechat public account “jinyang said” to receive my latest articles