HarmonyOS 鸿蒙Next 新创建项目hello world程序查看log报错

HarmonyOS 鸿蒙Next 新创建项目hello world程序查看log报错 以下是报错列表,作为一个新人,程序出错,去看log,结果这么多错误信息,怎么识别哪些错误是和程序本身相关的?有点无从下手的感觉

1-18 11:04:37.955 738-738/? E selinux_dmd/: type=1400 audit(0.0:27612): avc: denied { read write } for comm="containerd" name="ctrl_" dev="tmpfs" ino=48 scontext=u:r:ohco_containerd:s0 tcontext=u:object_r:tmpfs:s0 tclass=file permissive=1 find  pid= failed
01-18 11:04:37.955 738-738/? E selinux_dmd/: type=1400 audit(0.0:27612): avc: denied { read write } for comm="containerd" name="ctrl_" dev="tmpfs" ino=48 scontext=u:r:ohco_containerd:s0 tcontext=u:object_r:tmpfs:s0 tclass=file permissive=1 ExtractKeys failed
01-18 11:04:37.933 21382-14436/? E libc/    : toybox: Unable to open shared library libmemleak_tracker.so: dlopen failed: library "libmemleak_tracker.so" not found
01-18 11:04:37.922 614-614/? E containerd/: eof
01-18 11:04:37.922 614-614/? E containerd/: failed to read size
01-18 11:04:37.921 614-614/? E containerd/: [OHSH]stdout dup2
01-18 11:04:37.921 614-614/? E containerd/: [OHSH]stdout dup2
01-18 11:04:35.984 752-752/? E thermal/-daemon: logPower_print not support
01-18 11:04:39.687 21390-14437/? E libc/    : hidumper: Unable to open shared library libmemleak_tracker.so: dlopen failed: library "libmemleak_tracker.so" not found
01-18 11:04:39.711 21390-14437/? E 01510/BinderInvoker: 127: SendRequest: handle=0 result = -74
01-18 11:04:39.711 21390-14437/? E 01510/IPCObjectProxy: 558: GET_PROTO_INFO transact return error = -74
01-18 11:04:40.985 752-752/? E thermal/-daemon: logPower_print not support

更多关于HarmonyOS 鸿蒙Next 新创建项目hello world程序查看log报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复

我也遇到这个bug了,启动页面变成了白板,楼主解决这个问题了吗

更多关于HarmonyOS 鸿蒙Next 新创建项目hello world程序查看log报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


每个系统都有各种的日志,包括错误日志,只要不影响运行和查看自己的日志就行,可以添加TAG过滤掉系统的日志

在HarmonyOS鸿蒙Next中,新建的Hello World项目查看log时出现报错,可能是以下原因之一:

  1. SDK版本不匹配:项目使用的SDK版本与当前开发环境不兼容,导致log输出异常。检查build.gradle文件中的compileSdkVersiontargetSdkVersion,确保与已安装的SDK版本一致。

  2. 配置文件错误:config.jsonmodule.json5文件中可能存在配置错误,如权限未正确声明或资源路径错误,导致日志无法正常输出。检查这些文件,确保配置正确。

  3. 日志级别设置不当:默认日志级别可能屏蔽了部分信息,导致无法看到完整的log输出。通过HiLog.setLevel()调整日志级别,确保输出完整信息。

  4. 设备或模拟器问题:连接的设备或模拟器可能存在异常,无法正确输出日志。尝试重启设备或更换模拟器。

  5. IDE或工具链问题:DevEco Studio可能存在Bug或工具链配置错误。尝试更新IDE到最新版本,或清理项目缓存后重新构建。

  6. 权限问题:应用可能缺少必要的日志输出权限。检查config.json中的reqPermissions字段,确保已声明ohos.permission.LOG权限。

  7. 代码错误:HelloWorld代码中可能存在错误,如日志输出语句未正确使用HiLog API。确保日志输出代码格式正确,如HiLog.info(LABEL, "Hello World");

以上是可能导致log报错的常见原因。

回到顶部