@@ -380,7 +380,7 @@ For details about how to contribute, see [How to Contribute](contribute/how-to-
...
@@ -380,7 +380,7 @@ For details about how to contribute, see [How to Contribute](contribute/how-to-
OpenHarmony complies with Apache License Version 2.0. For details, see the LICENSE in each repository.
OpenHarmony complies with Apache License Version 2.0. For details, see the LICENSE in each repository.
OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BC%80%E6%BA%90%E8%BD%AF%E4%BB%B6%E5%8F%8A%E8%AE%B8%E5%8F%AF%E8%AF%81%E8%AF%B4%E6%98%8E.md).
OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](https://gitee.com/openharmony/docs/blob/master/en/contribute/third-party-open-source-software-and-license-notice.md).
@@ -7,10 +7,15 @@ A widget displays brief information about an application on the UI of another ap
...
@@ -7,10 +7,15 @@ A widget displays brief information about an application on the UI of another ap
Basic concepts:
Basic concepts:
- Widget provider
- Widget provider
The widget provider is an atomic service that provides the content to be displayed. It controls the display content, component layout, and component click events of a widget.
The widget provider is an atomic service that provides the content to be displayed. It controls the display content, component layout, and component click events of a widget.
- Widget host
- Widget host
The widget host is an application that displays the widget content and controls the position where the widget is displayed in the host application.
The widget host is an application that displays the widget content and controls the position where the widget is displayed in the host application.
- Widget Manager
- Widget Manager
The Widget Manager is a resident agent that manages widgets added to the system and provides functions such as periodic widget update.
The Widget Manager is a resident agent that manages widgets added to the system and provides functions such as periodic widget update.
2. Define a food data storage model, FoodData, and an enum variable, Category. The FoodData class contains the food ID, name, category, image, calories, protein, fat, carbohydrates, and vitamin C attributes.
2. Define a food data storage model, FoodData, and an enum variable, Category. The FoodData class contains the food ID, name, category, image, calories, protein, fat, carbohydrates, and vitamin C attributes.
The eTS programming language is an extension of the TS language and also supports the TS syntax.
The eTS programming language is an extension of the TS language and also supports the TS syntax.
### "usr/sbin/ninja: invalid option -- w" Displayed During the Build Process
### "usr/sbin/ninja: invalid option -- w" Displayed During the Build Process
-**Symptom**
-**Symptom**
The compilation fails, and **usr/sbin/ninja: invalid option -- w** is displayed.
The compilation fails, and **usr/sbin/ninja: invalid option -- w** is displayed.
-**Possible Causes**
-**Possible Causes**
The Ninja version in the compilation environment is outdated and does not support the **--w** option.
The Ninja version in the compilation environment is outdated and does not support the **--w** option.
-**Solution**
-**Solution**
Uninstall Ninja and GN in the environment and reinstall them by following instructions in [Obtaining Tools](../get-code/gettools-ide.md).
Uninstall Ninja and GN in the environment and reinstall them by following instructions in [Obtaining Tools](../get-code/gettools-ide.md).
### "/usr/bin/ld: cannot find -lncurses" Displayed During the Build Process
### "/usr/bin/ld: cannot find -lncurses" Displayed During the Build Process
-**Symptom**
-**Symptom**
The compilation fails, and **/usr/bin/ld: cannot find -lncurses** is displayed.
The compilation fails, and **/usr/bin/ld: cannot find -lncurses** is displayed.
-**Possible Causes**
-**Possible Causes**
The ncurses library is not installed.
The ncurses library is not installed.
-**Solution**
-**Solution**
```
```
Run **sudo apt-get install lib32ncurses5-dev** to install the library.
Run **sudo apt-get install lib32ncurses5-dev** to install the library.
```
```
...
@@ -34,13 +39,15 @@
...
@@ -34,13 +39,15 @@
### "line 77: mcopy: command not found" Displayed During the Build Process
### "line 77: mcopy: command not found" Displayed During the Build Process
-**Symptom**
-**Symptom**
The compilation fails, and **line 77: mcopy: command not found** is displayed.
The compilation fails, and **line 77: mcopy: command not found** is displayed.
-**Possible Causes**
-**Possible Causes**
Mcopy is not installed.
Mcopy is not installed.
-**Solution**
-**Solution**
```
```
Run **sudo apt-get install dosfstools mtools** to install mcopy.
Run **sudo apt-get install dosfstools mtools** to install mcopy.
```
```
...
@@ -49,37 +56,43 @@
...
@@ -49,37 +56,43 @@
### "riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory" Displayed During the Build Process
### "riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory" Displayed During the Build Process
-**Symptom**
-**Symptom**
The compilation fails, and the following information is displayed: **riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory**.
The compilation fails, and the following information is displayed: **riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory**.
-**Possible Causes**
-**Possible Causes**
Permission is required to access files in the **riscv** compiler path.
Permission is required to access files in the **riscv** compiler path.
-**Solution**
-**Solution**
Run the following command to query the directory where **gcc_riscv32** is located:
Run the following command to query the directory where **gcc_riscv32** is located:
```
```
which riscv32-unknown-elf-gcc
which riscv32-unknown-elf-gcc
```
```
Run the **chmod** command to change the directory permission to **755**.
Run the **chmod** command to change the directory permission to **755**.
### "No module named 'Crypto'" Displayed During the Build Process
### "No module named 'Crypto'" Displayed During the Build Process
- **Symptom**
- **Symptom**
The compilation fails, and **No module named'Crypto loaded** is displayed.
The compilation fails, and **No module named'Crypto loaded** is displayed.
- **Possible Causes**
- **Possible Causes**
Crypto is not installed in Python3.
Crypto is not installed in Python3.
- **Solution**
- **Solution**
1. Run the following command to query the Python version:
1. Run the following command to query the Python version:
```
```
python3 --version
python3 --version
```
```
2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome:
2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome:
```
```
sudo pip3 install pycryptodome
sudo pip3 install pycryptodome
```
```
...
@@ -88,13 +101,15 @@
...
@@ -88,13 +101,15 @@
### "xx.sh : xx unexpected operator" Displayed During the Build Process
### "xx.sh : xx unexpected operator" Displayed During the Build Process
- **Symptom**
- **Symptom**
The compilation fails, and **xx.sh [: xx unexpected operator** is displayed.
The compilation fails, and **xx.sh [: xx unexpected operator** is displayed.
- **Possible Causes**
- **Possible Causes**
The compilation environment is shell instead of bash.
The compilation environment is shell instead of bash.
- **Solution**
- **Solution**
```
```
sudo rm -rf /bin/sh
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
sudo ln -s /bin/bash /bin/sh
...
@@ -104,52 +119,58 @@
...
@@ -104,52 +119,58 @@
### "Could not find a version that satisfies the requirement six>=1.9.0" Displayed During the Build Process
### "Could not find a version that satisfies the requirement six>=1.9.0" Displayed During the Build Process
- **Symptom**
- **Symptom**
The following error occurs during compilation and building:
The following error occurs during compilation and building:
```
```
Could not find a version that satisfies the requirement six>=1.9.0
Could not find a version that satisfies the requirement six>=1.9.0
```
```
- **Possible Causes**
- **Possible Causes**
**six** is not installed.
**six** is not installed.
- **Solution**
- **Solution**
Solution 1: Run the **pip3 install six** command to install **six** online.
Solution 1: Run the **pip3 install six** command to install **six** online.
Method 2: Offline installation
Method 2: Offline installation
Download the installation package from [PyPI](https://pypi.org/project/six/#files).
Download the installation package from [PyPI](https://pypi.org/project/six/#files).
The burning status is not displayed after clicking **Burn** and selecting a serial port.
The burning status is not displayed after clicking **Burn** and selecting a serial port.
-**Possible Causes**
-**Possible Causes**
The IDE is not restarted after the DevEco plug-in is installed.
The IDE is not restarted after the DevEco plug-in is installed.
-**Solution**
-**Solution**
Restart the IDE.
Restart the IDE.
### No Command Output Is Displayed
### No Command Output Is Displayed
-**Symptom**
-**Symptom**
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**.
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**.
-**Possible Cause 1**
-**Possible Cause 1**
The serial port is connected incorrectly.
The serial port is connected incorrectly.
-**Solution**
-**Solution**
Change the serial port number.
Change the serial port number.
Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
-**Possible Cause 2**
-**Possible Cause 2**
The U-Boot of the board is damaged.
The U-Boot of the board is damaged.
-**Solution**
-**Solution**
Burn the U-Boot.
Burn the U-Boot.
If the fault persists after you perform the preceding operations, the U-Boot of the board may be damaged. You can burn the U-Boot by performing the following steps:
If the fault persists after you perform the preceding operations, the U-Boot of the board may be damaged. You can burn the U-Boot by performing the following steps:
1. Obtain the U-Boot file.
1. Obtain the U-Boot file.
...
@@ -90,41 +100,42 @@
...
@@ -90,41 +100,42 @@
### Windows-based PC Failed to Be Connected to the Board
### Windows-based PC Failed to Be Connected to the Board
-**Symptom**
-**Symptom**
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
**Figure 6** Failed to obtain the file image due to network disconnection
**Figure 6** Failed to obtain the file image due to network disconnection
### What should I do if garbled characters and segmentation faults occur during hb installation?
### What should I do if garbled characters and segmentation faults occur during hb installation?
-**Symptom**
-**Symptom**
Garbled characters and segmentation faults occur during the execution of the **python3 -m pip install --user ohos-build** command.
Garbled characters and segmentation faults occur during the execution of the **python3 -m pip install --user ohos-build** command.
-**Possible Causes**
-**Possible Causes**
pip is of an early version.
pip is of an early version.
-**Solution**
-**Solution**
Upgrade pip.
Upgrade pip.
```
```
python3 -m pip install -U pip
python3 -m pip install -U pip
```
```
...
@@ -24,15 +27,18 @@
...
@@ -24,15 +27,18 @@
### What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?
### What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?
-**Symptom**
-**Symptom**
The message "cannot import 'sysconfig' from 'distutils'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
The message "cannot import 'sysconfig' from 'distutils'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
-**Possible Causes**
-**Possible Causes**
The **distutils** module is unavailable.
The **distutils** module is unavailable.
-**Solution**
-**Solution**
Install **distutils**.
Install **distutils**.
```
```
sudo apt-get install python3.8-distutils
sudo apt-get install python3.8-distutils
```
```
...
@@ -41,15 +47,18 @@
...
@@ -41,15 +47,18 @@
### What should I do if the message "module 'platform' has no attribute 'linux_distribution'" is displayed during hb installation?
### What should I do if the message "module 'platform' has no attribute 'linux_distribution'" is displayed during hb installation?
-**Symptom**
-**Symptom**
The message "module 'platform' has no attribute 'linux_distribution'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
The message "module 'platform' has no attribute 'linux_distribution'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
### What should I do if the message "Could not find a version that satisfies the requirement ohos-build" is displayed during hb installation?
### What should I do if the message "Could not find a version that satisfies the requirement ohos-build" is displayed during hb installation?
-**Symptom**
-**Symptom**
The message "Could not find a version that satisfies the requirement ohos-build" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
The message "Could not find a version that satisfies the requirement ohos-build" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
-**Possible Causes**
-**Possible Causes**
The installation fails due to poor network connectivity.
The installation fails due to poor network connectivity.
-**Solution**
-**Solution**
1. Ensure that your computer has a good network connection. If the network connection is unstable, rectify the network fault and reinstall hb.
1. Ensure that your computer has a good network connection. If the network connection is unstable, rectify the network fault and reinstall hb.
2. If the network is functional, run the following commands to install hb by specifying a temporary PyPI source:
2. If the network is functional, run the following commands to install hb by specifying a temporary PyPI source:
### What should I do if the message "configure: error: no acceptable C compiler found in $PATH" is displayed during Python 3 installation?
### What should I do if the message "configure: error: no acceptable C compiler found in $PATH" is displayed during Python 3 installation?
-**Symptom**
-**Symptom**
The following error occurs during Python 3 installation:
The following error occurs during Python 3 installation:
```
```
configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
```
```
- **Possible Causes**
- **Possible Causes**
**gcc** is not installed.
**gcc** is not installed.
- **Solution**
- **Solution**
1. Run the **apt-get install gcc** command to install **gcc** online.
1. Run the **apt-get install gcc** command to install **gcc** online.
2. After the installation, reinstall Python 3.
2. After the installation, reinstall Python 3.
...
@@ -95,17 +110,20 @@
...
@@ -95,17 +110,20 @@
### What should I do if the message "-bash: make: command not found is displayed" during Python 3 installation?
### What should I do if the message "-bash: make: command not found is displayed" during Python 3 installation?
- **Symptom**
- **Symptom**
The following error occurs during Python 3 installation:
The following error occurs during Python 3 installation:
```
```
-bash: make: command not found
-bash: make: command not found
```
```
- **Possible Causes**
- **Possible Causes**
**Make** is not installed.
**Make** is not installed.
- **Solution**
- **Solution**
1. Run the **apt-get install make** command to install Make online.
1. Run the **apt-get install make** command to install Make online.
2. After the installation, reinstall Python 3.
2. After the installation, reinstall Python 3.
...
@@ -113,92 +131,104 @@
...
@@ -113,92 +131,104 @@
### What should I do if the message **zlib not available** is displayed during Python 3 installation?
### What should I do if the message **zlib not available** is displayed during Python 3 installation?
- **Symptom**
- **Symptom**
The following error occurs during Python 3 installation:
The following error occurs during Python 3 installation:
```
```
zipimport.ZipImportError: can't decompress data; zlib not available
zipimport.ZipImportError: can't decompress data; zlib not available
```
```
-**Possible Causes**
-**Possible Causes**
**zlib** is not installed.
**zlib** is not installed.
-**Solution**
-**Solution**
Solution 1: Run the **apt-get install zlib** command to install **zlib** online.
Solution 1: Run the **apt-get install zlib** command to install **zlib** online.
Solution 2: If the software source does not contain **zlib**, download the source code from <xrefhref="http://www.zlib.net/"scope="external"class="- topic/xref "id="xref17252104445818">http://www.zlib.net/</xref>.
Solution 2: If the software source does not contain **zlib**, download the source code from <xrefhref="http://www.zlib.net/"scope="external"class="- topic/xref "id="xref17252104445818">http://www.zlib.net/</xref>.
@@ -20,7 +20,7 @@ The compiled executable program is run directly without being converted to an ap
...
@@ -20,7 +20,7 @@ The compiled executable program is run directly without being converted to an ap
Call the **UtilsSetEnv** function of the KV store to set the data storage path.
Call the **UtilsSetEnv** function of the KV store to set the data storage path.
```
```
UtilsSetEnv("/storage/com.example.kv");
UtilsSetEnv("/storage/com.example.kv");
```
```
...
@@ -38,7 +38,7 @@ There is no such a global variable.
...
@@ -38,7 +38,7 @@ There is no such a global variable.
You can obtain DOM elements via the **ref** attribute. You can use methods of the obtained elements but cannot change their attributes. The sample code is as follows:
You can obtain DOM elements via the **ref** attribute. You can use methods of the obtained elements but cannot change their attributes. The sample code is as follows:
```
```
...
@@ -77,7 +77,7 @@ You can pass values through **params** of the **router.replace** method. The sam
...
@@ -77,7 +77,7 @@ You can pass values through **params** of the **router.replace** method. The sam
Set **params** to the values to be passed on a page. The sample code is as follows:
Set **params** to the values to be passed on a page. The sample code is as follows:
```
```
router.replace({
router.replace({
uri:'pages/detail/detail', // URI of the page to be redirected to.
uri:'pages/detail/detail', // URI of the page to be redirected to.
...
@@ -87,7 +87,7 @@ router.replace({
...
@@ -87,7 +87,7 @@ router.replace({
Receive the passed values on another page.
Receive the passed values on another page.
```
```
onInit(){
onInit(){
const data = this.transferData; // Use the onInit function to receive the passed data.
const data = this.transferData; // Use the onInit function to receive the passed data.
...
@@ -141,7 +141,7 @@ The object or its attributes are not defined before dynamic binding.
...
@@ -141,7 +141,7 @@ The object or its attributes are not defined before dynamic binding.
### How do I implement relative and absolute positioning?
### How do I implement relative and absolute positioning?
You can use the **<div>** and **<stack>** (with **top** and **left** attributes) components to implement relative positioning and absolute positioning.
You can use the **<div\>** and **<stack\>** (with **top** and **left** attributes) components to implement relative positioning and absolute positioning.
### How do I display or hide a component?
### How do I display or hide a component?
...
@@ -180,9 +180,11 @@ Do not include too many elements in an array. Avoid frequent operations on a lar
...
@@ -180,9 +180,11 @@ Do not include too many elements in an array. Avoid frequent operations on a lar
### Why does hdc_std fail to connect to a device?
### Why does hdc_std fail to connect to a device?
-**Symptom**
-**Symptom**
After the **hdc_std list targets** command is executed, **[Empty]** is displayed.
After the **hdc_std list targets** command is executed, **[Empty]** is displayed.
-**Solution**
-**Solution**
1. The device cannot be identified.
1. The device cannot be identified.
Check whether **HDC Device** exists under the **Universal Serial Bus controllers** in the **Device Manager**. If **HDC Device** does not exist, the device cannot be connected. In this case, disconnect and then reconnect the USB connection between the test PC and the OpenHarmony device, or burn the latest image.
Check whether **HDC Device** exists under the **Universal Serial Bus controllers** in the **Device Manager**. If **HDC Device** does not exist, the device cannot be connected. In this case, disconnect and then reconnect the USB connection between the test PC and the OpenHarmony device, or burn the latest image.
2. hdc_std works improperly.
2. hdc_std works improperly.
...
@@ -194,7 +196,9 @@ Do not include too many elements in an array. Avoid frequent operations on a lar
...
@@ -194,7 +196,9 @@ Do not include too many elements in an array. Avoid frequent operations on a lar
### hdc_std fail to run
### hdc_std fail to run
-**Symptom**
-**Symptom**
After you click **hdc_std.exe**, the file fails to execute.
After you click **hdc_std.exe**, the file fails to execute.
-**Solution**
-**Solution**
**hdc_std.exe** requires no installation. You can use it after placing it to a local directory or adding the tool path to environment variables. Run the **cmd** command and then run the **hdc_std** command to start the tool.
**hdc_std.exe** requires no installation. You can use it after placing it to a local directory or adding the tool path to environment variables. Run the **cmd** command and then run the **hdc_std** command to start the tool.
## What should I do if garbled characters and segmentation faults occur during hb installation?
## What should I do if garbled characters and segmentation faults occur during hb installation?
-**Symptom**
-**Symptom**
Garbled characters and segmentation faults occur during the execution of the **python3 -m pip install --user ohos-build** command.
Garbled characters and segmentation faults occur during the execution of the **python3 -m pip install --user ohos-build** command.
-**Possible Causes**
-**Possible Causes**
pip is of an early version.
pip is of an early version.
-**Solution**
-**Solution**
Upgrade pip.
Upgrade pip.
```
```
python3 -m pip install -U pip
python3 -m pip install -U pip
```
```
...
@@ -21,15 +24,18 @@
...
@@ -21,15 +24,18 @@
## What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?
## What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?
-**Symptom**
-**Symptom**
The message "cannot import 'sysconfig' from 'distutils'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
The message "cannot import 'sysconfig' from 'distutils'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
-**Possible Causes**
-**Possible Causes**
The **distutils** module is unavailable.
The **distutils** module is unavailable.
-**Solution**
-**Solution**
Install distutils.
Install distutils.
```
```
sudo apt-get install python3.8-distutils
sudo apt-get install python3.8-distutils
```
```
...
@@ -38,15 +44,18 @@
...
@@ -38,15 +44,18 @@
## What should I do if the message "module 'platform' has no attribute 'linux_distribution'" is displayed during hb installation?
## What should I do if the message "module 'platform' has no attribute 'linux_distribution'" is displayed during hb installation?
-**Symptom**
-**Symptom**
The message "module 'platform' has no attribute 'linux_distribution'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
The message "module 'platform' has no attribute 'linux_distribution'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
## What should I do if the message "Could not find a version that satisfies the requirement ohos-build" is displayed during hb installation?
## What should I do if the message "Could not find a version that satisfies the requirement ohos-build" is displayed during hb installation?
-**Symptom**
-**Symptom**
The message "Could not find a version that satisfies the requirement ohos-build" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
The message "Could not find a version that satisfies the requirement ohos-build" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
-**Possible Causes**
-**Possible Causes**
The installation fails due to poor network connectivity.
The installation fails due to poor network connectivity.
-**Solution**
-**Solution**
1. Ensure that your computer has a good network connection. If the network connection is unstable, rectify the network fault and reinstall hb.
1. Ensure that your computer has a good network connection. If the network connection is unstable, rectify the network fault and reinstall hb.
2. If the network is functional, run the following commands to install hb by specifying a temporary PyPI source:
2. If the network is functional, run the following commands to install hb by specifying a temporary PyPI source: