[HarmonyOS NEXT]鸿蒙应用开发随手记1--“The deviceType or apiVersion of the target device does not match”解决方案
·
问题:
项目突然想切换到平板看下读取到的设备类型,于是打开设备管理器,点开平板模拟器,一点就是报错:“The deviceType or apiVersion of the target device does not match”,直接运行不起来
解决方案:
这段报错说得很明白,就是目标设备的deviceType或apiVersion不匹配,那既然代码在手机模拟器上运行没问题,自然是平板模拟器的相关配置出错了
直接双击shift全局搜“deviceType”和“apiVersion”,发现“apiVersion”没有完全匹配的项,但“deviceType”有,而且就在module.json5这个配置文件中,赫然写着:
{
"module": {
"deviceTypes": [
"phone"
]
}
}
类型只有Phone,也就是手机,没有平板,于是愉快地添加tablet上去,搞定!
{
"module": {
"deviceTypes": [
"phone",'tablet'
]
}
}
更多推荐

所有评论(0)