当前位置: 首页 > news >正文

【错误记录】HarmonyOS 运行报错 ( Failure INSTALL_PARSE_FAILED_USESDK_ERROR )

文章目录

  • 一、报错信息
  • 二、问题分析
  • 三、解决方案





一、报错信息



在 DevEco Studio 中 , 使用 远程设备 , 向 P40

Failure[INSTALL_PARSE_FAILED_USESDK_ERROR]
compileSdkVersion and releaseType of the app do not match the apiVersion and releaseType on the device.

在这里插入图片描述





二、问题分析



报错信息翻译后内容为 : 应用的 compileSdkVersion 和 releaseType 与设备上的 apiVersion 和 releaseType 不匹配 ;

当前使用的 P40 远程设备 , 使用的是 API 8 版本的 SDK ;

在这里插入图片描述

在 根目录下的 build-profile.json5 中配置的 编译版本 ,

  • compileSdkVersion 配置的 编译版本是 API 9 ;
  • compatibleSdkVersion 配置的 最低兼容的版本是 API 9 , 该配置使得应用不能再低于 API 9 的设备中运行 ;

在这里插入图片描述

build-profile.json5 完整配置信息如下 :

{"app": {"signingConfigs": [],"compileSdkVersion": 9,"compatibleSdkVersion": 9,"products": [{"name": "default","signingConfig": "default",}],"buildModeSet": [{"name": "debug",},{"name": "release"}]},"modules": [{"name": "entry","srcPath": "./entry","targets": [{"name": "default","applyToProducts": ["default"]}]}]
}

如果 只将 “compatibleSdkVersion”: 设置改为 8 , 会报如下错误 :

Apps of API version 9 cannot run on devices of API version 8 or earlier. Set compatibleSdkVersion to 9 or a larger value in the project-level build-profile.json5 file.

API 版本 9 的应用程序无法在 API 版本 8 或更早的设备上运行 ,

在 项目级构建配置文件 build-profile.json5 file 中 将 compatibleSdkVersion 设置为 9 或更大的值 ;

这里需要同时将 compileSdkVersion 和 compatibleSdkVersion 版本号都改为 8 ;

    "compileSdkVersion": 8,"compatibleSdkVersion": 8,

此时 点击 Sync Now 进行同步 , 会报如下错误 ;

Cause:
1.The @ohos/hvigor version () is not within the expected range 3.x.x (3.x.x >= 3.0.9).
2.The @ohos/hvigor-ohos-plugin version () is not within the expected range 3.x.x (3.x.x >= 3.0.9).

Solution: Change the values of @ohos/hvigor to 3.0.9 and @ohos/hvigor-ohos-plugin to 3.0.9, while updating the command line script hvigor-wrapper.js that matches hvigor, which will auto-install the respective versions of the tools. Then sync the project again.

翻译后 :

原因:
1.@ohos/hvigor version () 不在预期的 3.x.x (3.x.x >= 3.0.9) 范围内 ;
2.@ohos/hvigor-ohos-plugin version () 不在预期的 3.x.x (3.x.x >= 3.0.9) 范围内 ;

解决方法:将 @ohos/hvigor 的值改为 3.0.9 并且 将 @ohos/hvigor-ohos-plugin 的值改为3.0.9 , 同时更新与 hvigor 匹配的命令行脚本hvigor-wrapper.js , 该脚本将自动安装相应版本的工具 , 然后再次同步项目 ;

在这里插入图片描述





三、解决方案



由于该项目创建时 , 直接创建的 API 9 的项目 , 所有的配置都基于 API 9 进行 配置的 , 这里重新创建一个 API 8 的项目 ;

在这里插入图片描述

选择项目的 SDK 版本号为 API 8 , 然后点击 Finish 完成创建 ;

在这里插入图片描述

http://www.lryc.cn/news/357700.html

相关文章:

  • 使用C语言openssl库实现 RSA加密 和 消息验证
  • 海外投放面试手册
  • 第十三章 进程与线程
  • Flink面试整理-对Flink的高级特性如CEP(复杂事件处理)、状态后端选择和调优等有所了解
  • 算法:树状数组
  • Kafka SASL_SSL集群认证
  • 同城交友论坛静态页面app Hbuild
  • spring session+redis存储session,实现用户登录功能,并在拦截器里面判断用户session是否过期,过期就跳转到登录页面
  • Debug-013-el-loading中显示倒计时时间
  • 5月29日,每日信息差
  • 2024年弘连网络FIC大会竞赛题线下决赛题
  • Element-UI 入门指南:从安装到自定义主题的详细教程
  • vs工程添加自定义宏
  • shell脚本:将一维数组以二维数组显示
  • QT C++ 读写mySQL数据库 图片 例子
  • Unix环境高级编程--8-进程控制---8.1-8.2进程标识-8.3fork函数-8.4 vfork函数
  • Facebook之魅:数字社交的体验
  • 【重装windows遇到网络适配器无法更改】
  • FFmpeg+QT播放器实战1---UI页面的设计
  • C/C++语法|pthread线程库的使用
  • 四川汇聚荣聚荣科技有限公司是正规的吗?
  • tomcat学习--部署java项目
  • 用 vue3 + phaser 实现经典小游戏:飞机大战
  • 【Linux|数据恢复】extundelete和ext4magic数据恢复工具使用
  • 用户接入和认证技术
  • 【面试】Java虚拟机的生命周期
  • Nginx高可用性架构:实现负载均衡与故障转移的探索
  • 计算机网络-运输层
  • 网络通信(一)
  • Linux环境中部署docker私有仓库Registry与远程访问详细流程