uni-app 4.32版本鸿蒙真机调试报错

发布于 1周前 作者 yuanlaile 来自 uni-app

uni-app 4.32版本鸿蒙真机调试报错

安装鸿蒙工程依赖日志

17:32:15.146 安装鸿蒙工程的依赖 …

17:32:16.141 ohpm INFO: MetaDataFetcher fetching meta info of package ‘@uni_modules/uni-payment-alipay’ from https://ohpm.openharmony.cn/ohpm/

ohpm INFO: MetaDataFetcher fetching meta info of package ‘@dcloudio/uni-app-runtime’ from https://ohpm.openharmony.cn/ohpm/

ohpm INFO: MetaDataFetcher fetching meta info of package ‘@ohos/hypium’ from https://ohpm.openharmony.cn/ohpm/

ohpm ERROR: missing: @dcloudio/uts-harmony@E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\ets\uts, required by @

ohpm ERROR: Found exception: Error: Fetch local folder package error, E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\ets\uts does not exist., reached retry limit or non retryable error encountered.

ohpm ERROR: ERUNNING execute tasks failed, Error: Fetch local folder package error, E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\ets\uts does not exist.

ohpm ERROR: missing: @dcloudio/uni-app-harmony@E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\ets\uni-app-harmony, required by @

ohpm ERROR: Found exception: Error: Fetch local folder package error, E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\ets\uni-app-harmony does not exist., reached retry limit or non retryable error encountered.

ohpm ERROR: missing: @dcloudio/uni-app-harmony-framework@E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\resources\rawfile\uni-app, required by @

ohpm ERROR: Found exception: Error: Fetch local folder package error, E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\resources\rawfile\uni-app does not exist., reached retry limit or non retryable error encountered.

ohpm ERROR: Install failed, detail: Error: Fetch local folder package error, E:\hongmeng\aihuihua\ai_painting\unpackage\debug\app-harmony-2f573459\entry\src\main\ets\uts does not exist.

17:32:16.141 安装鸿蒙工程依赖失败

开发环境、版本号和项目创建方式

信息 描述
开发环境 未提供
版本号 未提供
项目创建方式 未提供

更多关于uni-app 4.32版本鸿蒙真机调试报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

13 回复

请删除 harmony-configs 目录里的 oh-package.json5 文件,再 unpackage 目录,然后重试。
最好能删除 harmony-configs 目录中所有不必要(没有自己定制内容)的文件。

更多关于uni-app 4.32版本鸿蒙真机调试报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


改动后还是会报错,4.29版本开发的鸿蒙应用在4.32版本真机调试报错,这个需要如何整改,有没有相关文档

回复 x***@163.com: 看样子像是 harmony-configs/oh-package.json 里面包含了陈旧内容,可以尝试先把 harmony-configs 和 unpackage 都完全删除,然后执行【运行到鸿蒙】,后续再根据需要逐步在 harmony-configs 目录中添加文件内容。

回复 x***@163.com: 另外,如果项目类型是 cli 项目的话,也有可能是跟项目关联的编译器版本(在项目依赖里面)太旧了,在控制台的日志信息里面应该有提示,可以尝试按照提示进行升级。

回复 枭云: 我也遇到了这个问题

按照你的步骤删除了oh-package.json5文件,【运行到鸿蒙】报错: 16:24:07.264 ohpm ERROR: missing: @dcloudio/uni-app-runtime@F:\HbuilderX%20Projects\hxERP-v3\unpackage\debug\app-harmony-00b8bf5b\libs\UniAppRuntime.har, required by @ ohpm ERROR: Found exception: Error: Fetch local file package error, F:\HbuilderX%20Projects\hxERP-v3\unpackage\debug\app-harmony-00b8bf5b\libs\UniAppRuntime.har does not exist., reached retry limit or non retryable error encountered. ohpm ERROR: ERUNNING execute tasks failed, Error: Fetch local file package error, F:\HbuilderX%20Projects\hxERP-v3\unpackage\debug\app-harmony-00b8bf5b\libs\UniAppRuntime.har does not exist. ohpm ERROR: Install failed, detail: Error: Fetch local file package error, F:\HbuilderX%20Projects\hxERP-v3\unpackage\debug\app-harmony-00b8bf5b\libs\UniAppRuntime.har does not exist. 16:24:07.264 安装鸿蒙工程依赖失败

回复 DCloud_云服务_MAQ: 把 harmony-configs 和 unpackage 都完全删除后,【运行到鸿蒙】后,生成的harmony-configs文件夹是空的,是什么原因。 我用的HX是4.33.2024111702-alpha版本, 用非alpha的29版本运行后就能生成。

回复 honeyChen: 新版本的 HX 为了减少在版本升级的时候与开发者已有配置文件的冲突,调整了 harmony-configs 目录的使用策略,缺省不再生成配置文件,目录依然存在,开发者可以根据自己的需要在里面添加文件。

14:58:04.426 开始制作运行包 .hap,请耐心等待 … 14:58:06.309 > hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5.

hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor WARN: The current module ‘app-harmony-26d8f534’ has dependency which is not installed at its oh-package.json5. hvigor Finished :entry:clean… after 2 ms hvigor Finished :entry:default@PreBuild… after 67 ms hvigor Finished :entry:default@GenerateMetadata… after 2 ms hvigor Finished :entry:default@ConfigureCmake… after 1 ms hvigor Finished :entry:default@MergeProfile… after 7 ms hvigor Finished :entry:default@CreateBuildProfile… after 1 ms hvigor Finished :entry:default@PreCheckSyscap… after 1 ms hvigor Finished :entry:default@GeneratePkgContextInfo… after 1 ms hvigor Finished :entry:default@ProcessIntegratedHsp… after 1 ms hvigor Finished :entry:default@BuildNativeWithCmake… after 1 ms hvigor Finished :entry:default@MakePackInfo… after 3 ms hvigor Finished :entry:default@ProcessProfile… after 60 ms hvigor Finished :entry:default@SyscapTransform… after 1 ms hvigor Finished :entry:default@ProcessRouterMap… after 2 ms hvigor Finished :entry:default@BuildNativeWithNinja… after 1 ms hvigor Finished :entry:default@ProcessResource… after 2 ms hvigor ERROR: Bytecode HARs: [@uni_modules/uni-payment-alipay, @dcloudio/uni-app-runtime] not supported when useNormalizedOHMUrl is not true.

Try the following:

Please check useNormalizedOHMUrl in the project-level build-profile.json5 file.

hvigor ERROR: Failed :entry:default@GenerateLoaderJson… hvigor ERROR: BUILD FAILED in 1 s 263 ms 14:58:06.309 运行包制作失败

这个是 harmony-configs/build-profile.json5 文件内容与新版本的鸿蒙工程模板不匹配导致的,删除 harmony-configs 目录和 unpackage 目录,然后重试。

删除后报错的嘛

新版本又报错了

针对您提到的uni-app 4.32版本在鸿蒙真机调试时出现的报错问题,由于具体的错误信息未提供,我无法直接定位到具体的错误原因。但我可以提供一些常见的调试步骤和代码示例,帮助您更好地进行问题排查和解决。

1. 确认环境配置

首先,确保您的开发环境已经正确配置了鸿蒙系统的调试工具。这通常包括安装HBuilderX、配置鸿蒙SDK以及连接鸿蒙真机等步骤。

2. 检查项目配置

在uni-app项目中,检查manifest.json文件,确保其中的平台配置正确无误。特别是关于鸿蒙平台的配置,如mp-harmonyos部分。

{
  "mp-harmonyos": {
    "appid": "your_app_id", // 替换为您的鸿蒙应用ID
    "setting": {
      // 其他配置...
    }
  }
}

3. 调试代码示例

为了帮助您更好地理解如何在鸿蒙真机上进行调试,以下是一个简单的uni-app示例,该示例在鸿蒙设备上显示一个“Hello, HarmonyOS!”的文本。

index.vue

<template>
  <view>
    <text>{{ message }}</text>
  </view>
</template>

<script>
export default {
  data() {
    return {
      message: 'Hello, HarmonyOS!'
    };
  },
  onLoad() {
    // 可以在这里添加页面加载时的逻辑
    console.log('Page loaded on HarmonyOS device');
  }
};
</script>

<style>
/* 添加一些简单的样式 */
view {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #ffffff;
}
text {
  font-size: 24px;
  color: #000000;
}
</style>

4. 查看日志和错误信息

在HBuilderX中运行项目并连接到鸿蒙真机后,注意观察控制台输出的日志信息。如果报错,通常会在这里显示详细的错误信息,这将是您解决问题的关键线索。

5. 尝试简化代码

如果问题依旧无法解决,尝试逐步简化您的代码,逐步排除可能的错误来源。从最简单的页面开始,逐步添加功能,直到复现问题。

6. 查阅官方文档和社区

最后,不要忘记查阅uni-app和鸿蒙系统的官方文档,以及相关的开发者社区和论坛。这些地方通常会有其他开发者遇到并解决的问题,以及官方提供的解决方案。

希望这些步骤和代码示例能帮助您解决在鸿蒙真机调试时遇到的问题。如果问题依旧存在,请提供更详细的错误信息,以便进一步分析。

回到顶部