@@ -7,10 +7,15 @@ A widget displays brief information about an application on the UI of another ap
Basic concepts:
- 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.
- 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.
- Widget Manager
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.
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
-**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**
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**
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
-**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**
The ncurses library is not installed.
The ncurses library is not installed.
-**Solution**
```
Run **sudo apt-get install lib32ncurses5-dev** to install the library.
```
...
...
@@ -34,13 +39,15 @@
### "line 77: mcopy: command not found" Displayed During the Build Process
-**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**
Mcopy is not installed.
Mcopy is not installed.
-**Solution**
```
Run **sudo apt-get install dosfstools mtools** to install mcopy.
```
...
...
@@ -49,37 +56,43 @@
### "riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory" Displayed During the Build Process
-**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**
Permission is required to access files in the **riscv** compiler path.
Permission is required to access files in the **riscv** compiler path.
-**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
```
```
Run the **chmod** command to change the directory permission to **755**.
### "No module named 'Crypto'" Displayed During the Build Process
- **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**
Crypto is not installed in Python3.
Crypto is not installed in Python3.
- **Solution**
1. Run the following command to query the Python version:
```
python3 --version
```
2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome:
```
sudo pip3 install pycryptodome
```
...
...
@@ -88,13 +101,15 @@
### "xx.sh : xx unexpected operator" Displayed During the Build Process
- **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**
The compilation environment is shell instead of bash.
The compilation environment is shell instead of bash.
- **Solution**
```
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
...
...
@@ -104,52 +119,58 @@
### "Could not find a version that satisfies the requirement six>=1.9.0" Displayed During the Build Process
- **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
```
```
- **Possible Causes**
**six** is not installed.
**six** is not installed.
- **Solution**
Solution 1: Run the **pip3 install six** command to install **six** online.
Method 2: Offline installation
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**
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**
Restart the IDE.
### No Command Output Is Displayed
-**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**
The serial port is connected incorrectly.
The serial port is connected incorrectly.
-**Solution**
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.
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**
The U-Boot of the board is damaged.
The U-Boot of the board is damaged.
-**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:
1. Obtain the U-Boot file.
...
...
@@ -90,41 +100,42 @@
### Windows-based PC Failed to Be Connected to the Board
-**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
### What should I do if garbled characters and segmentation faults occur during hb installation?
-**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**
pip is of an early version.
pip is of an early version.
-**Solution**
Upgrade pip.
Upgrade pip.
```
python3 -m pip install -U pip
```
...
...
@@ -24,15 +27,18 @@
### What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?
-**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**
The **distutils** module is unavailable.
The **distutils** module is unavailable.
-**Solution**
Install **distutils**.
Install **distutils**.
```
sudo apt-get install python3.8-distutils
```
...
...
@@ -41,15 +47,18 @@
### What should I do if the message "module 'platform' has no attribute 'linux_distribution'" is displayed during hb installation?
-**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?
-**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**
The installation fails due to poor network connectivity.
The installation fails due to poor network connectivity.
-**Solution**
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:
### What should I do if the message "configure: error: no acceptable C compiler found in $PATH" is displayed during Python 3 installation?
-**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
```
```
- **Possible Causes**
**gcc** is not installed.
**gcc** is not installed.
- **Solution**
1. Run the **apt-get install gcc** command to install **gcc** online.
2. After the installation, reinstall Python 3.
...
...
@@ -95,17 +110,20 @@
### What should I do if the message "-bash: make: command not found is displayed" during Python 3 installation?
- **Symptom**
The following error occurs during Python 3 installation:
The following error occurs during Python 3 installation:
```
-bash: make: command not found
```
```
- **Possible Causes**
**Make** is not installed.
**Make** is not installed.
- **Solution**
1. Run the **apt-get install make** command to install Make online.
2. After the installation, reinstall Python 3.
...
...
@@ -113,92 +131,104 @@
### What should I do if the message **zlib not available** is displayed during Python 3 installation?
- **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
```
```
-**Possible Causes**
**zlib** is not installed.
**zlib** is not installed.
-**Solution**
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>.
Then run the following commands to install **zlib** offline:
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>.
@@ -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.
```
UtilsSetEnv("/storage/com.example.kv");
```
...
...
@@ -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:
```
...
...
@@ -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:
```
router.replace({
uri:'pages/detail/detail', // URI of the page to be redirected to.
...
...
@@ -87,7 +87,7 @@ router.replace({
Receive the passed values on another page.
```
onInit(){
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.
### 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?
...
...
@@ -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?
-**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**
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.
2. hdc_std works improperly.
...
...
@@ -194,7 +196,9 @@ Do not include too many elements in an array. Avoid frequent operations on a lar
### hdc_std fail to run
-**Symptom**
After you click **hdc_std.exe**, the file fails to execute.
After you click **hdc_std.exe**, the file fails to execute.
-**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.
## What should I do if garbled characters and segmentation faults occur during hb installation?
-**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**
pip is of an early version.
pip is of an early version.
-**Solution**
Upgrade pip.
Upgrade pip.
```
python3 -m pip install -U pip
```
...
...
@@ -21,15 +24,18 @@
## What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?
-**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**
The **distutils** module is unavailable.
The **distutils** module is unavailable.
-**Solution**
Install distutils.
Install distutils.
```
sudo apt-get install python3.8-distutils
```
...
...
@@ -38,15 +44,18 @@
## What should I do if the message "module 'platform' has no attribute 'linux_distribution'" is displayed during hb installation?
-**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?
-**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**
The installation fails due to poor network connectivity.
The installation fails due to poor network connectivity.
-**Solution**
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: