Mac HarmonyOS Failure[INSTALL_PARSE_FAILED_USESDK_ERROR]

In the MAC environment, during the development of HarmonyOS, the project runs to the simulator and reports the following errors:

Failure[INSTALL_PARSE_FAILED_USESDK_ERROR]

compileSdkVersion and releaseType of the app do not match the apiVersion and releaseType on the device.

Operation steps.

I. If the HDC tool environment variables are not configured, configure them as follows, and skip this step if they have been configured.

1. Open Mac terminal and enter the following command to open the bash_profile file.

open .bash_profile

2. In the bash_profile file, configure the environment variables, here the PATH path, refer to your own sdk path, version 3.0.0.1 is the version corresponding to Toolschains under API Version7 in my own SDK, the value is 3.0.0.1.

export PATH=$PATH:/Users/tangkun/Library/HarmonyOS/Sdk/toolchains/{3.0.0.1}
export CLASSPATH
HDC_SERVER_PORT=7035
launchctl setenv HDC_SERVER_PORT $HDC_SERVER_PORT
export HDC_SERVER_PORT

3. Save the configured environment variables and enter the following command in the open terminal.

source .bash_profile

4. Restart the development tool DevEco-Studio.

Second, the following is the operation of configured HDC environment variables:
In the terminal terminal of DevEco-Studio, enter the following command:

. /hdc shell

(Windows environment does not need the previous . /hdc shell)

Next, enter the following command in the terminal, but this time you do not need to enter . /, in terminal my Huawei emulator output 6.

getprop hw_sc.build.os.apiversion

This apiversion version number 6 is smaller than the version number 7 in my project’s build.gradle and project’s build.gradle, so it causes my project to run on this apiversion version 6 emulator with the following direct error.

The version numbers of entry and application in the build.gradle:
compileSdkVersion 7 and compatibleSdkVersion 7

Solution:

1. lower the compileSdkVersion and compatibleSdkVersion version numbers in the build.gradle file of entry and application to 6.

2. Use an emulator with Api 7 for debugging.

Read More: