HarmonyOS鸿蒙Next中DAYU200刷5.1.0.106后跑native sample应用实际设备错误但是previewer正常

HarmonyOS鸿蒙Next中DAYU200刷5.1.0.106后跑native sample应用实际设备错误但是previewer正常 [设备] DAYU200
[系统] 来自CI。version-Master_Version-OpenHarmony_5.1.0.106-20250428_032652-dayu200_5.1.0-Release_img
[步骤]

  1. DevEco Studio (5.0.5) ,创建Native 应用
  2. 运行正常
  3. 点击 hello world

应用直接崩溃提示日志


09-08 10:36:03.361 2390-2390 C02805/InputKeyFlow com.malon…lloworld I [][OnPointerEvent:210] ac: down: 711
09-08 10:36:03.361 2390-2390 C02805/InputKeyFlow com.malon…lloworld I [P:D:711][OnPointerEvent:581] id:711 recv
09-08 10:36:03.362 2390-2390 C04213/InputKeyFlow com.malon…lloworld I [input_transfer_station.cpp] HandleInputEvent: eid:0,InputId:711,wid:14,ac:2
09-08 10:36:03.363 2390-2390 C03919/AceInputTracking com.malon…lloworld I [mmi_event_convertor.cpp(729)-(-1:100000:singleton)] pointdown windowId: 14
09-08 10:36:03.363 2390-2390 C03951/InputKeyFlow com.malon…lloworld I [pipeline_context.cpp(2714)-(100000:100000:scope)] InputTracking id:711, fingerId:0, x=378.000, y=676.000 type=0, inject=0
09-08 10:36:03.364 2390-2390 C03951/InputKeyFlow com.malon…lloworld I [event_manager.cpp(169)-(100000:100000:scope)] InputTracking id:711, touch test hitted node info: fingerId: 0{ tag: Text, inspectorId: , frameRect: RectT (149.50, 0.00) - [421.00 x 88.00], depth: 7 };
09-08 10:36:03.364 2390-2390 C03951/InputKeyFlow com.malon…lloworld I [event_manager.cpp(309)-(100000:100000:scope)] InputTracking id:711, touch test hitted recognizer type info: recognizer type ClickRecognizer node info: { tag: Text, inspectorId: };
09-08 10:36:03.365 2390-2390 C03f00/MUSL-LDSO com.malon…lloworld E Open absolute_path library: check ns accessible failed, pathname /system/lib/libstylus_innerapi.z.so namespace ndk.
09-08 10:36:03.365 2390-2390 C03f00/MUSL-LDSO com.malon…lloworld E Error loading header /system/lib/libstylus_innerapi.z.so, namespace ndk has no inherits, errno=2
09-08 10:36:03.365 2390-2390 C03f00/MUSL-LDSO com.malon…lloworld E Error loading header: can’t find library /system/lib/libstylus_innerapi.z.so in namespace: default
09-08 10:36:03.365 2390-2390 C03f00/MUSL-LDSO com.malon…lloworld E dlopen_impl load library header failed for /system/lib/libstylus_innerapi.z.so
09-08 10:36:03.367 2390-2390 C03919/AceInputTracking com.malon…lloworld I [event_manager.cpp(1900)-(100000:100000:scope)] Consumed new event id=711 in ace_container, lastEventInfo: id:-1
09-08 10:36:03.370 2390-2390 C02805/InputKeyFlow com.malon…lloworld I [][OnPointerEvent:210] ac: move: 712
09-08 10:36:03.399 2390-2390 C02805/InputKeyFlow com.malon…lloworld I [][OnPointerEvent:210] ac: move, first: 713-(2025-09-08 10:36:03.379ms), 714, count: 2, last: ac: up: 715
09-08 10:36:03.399 2390-2390 C02805/InputKeyFlow com.malon…lloworld I [P:U:715][OnPointerEvent:581] id:715 recv
09-08 10:36:03.399 2390-2390 C04213/InputKeyFlow com.malon…lloworld I [input_transfer_station.cpp] HandleInputEvent: eid:1,InputId:715,wid:14,ac:4
09-08 10:36:03.399 2390-2390 C03951/InputKeyFlow com.malon…lloworld I [pipeline_context.cpp(2714)-(100000:100000:scope)] InputTracking id:715, fingerId:0, x=378.000, y=676.000 type=1, inject=0
09-08 10:36:03.400 2390-2390 C0391e/AceGesture com.malon…lloworld I [click_recognizer.cpp(304)-(100000:100000:scope)] Click try accept
09-08 10:36:03.400 2390-2390 C03951/InputKeyFlow com.malon…lloworld I [click_recognizer.cpp(167)-(100000:100000:scope)] Click accepted, tag: Text
09-08 10:36:03.402 2390-2390 C03f00/ArkCompiler com.malon…lloworld W [default] [GetNativeOrCjsExports:50] Load native module failed, so is @normalized:Y&&&libentry.so&
09-08 10:36:03.403 2390-2390 C03f00/ArkCompiler com.malon…lloworld E [default] [Call:3621] occur exception need return
09-08 10:36:03.403 2390-2390 C03f00/ArkCompiler com.malon…lloworld E [ecmascript] Pending exception before ExecutePendingJob called, in line:5601, exception details as follows:
09-08 10:36:03.403 2390-2390 C03f00/ArkCompiler com.malon…lloworld E TypeError: Cannot read property add of undefined
Cannot get SourceMap info, dump raw stack:
at anonymous (entry|entry|1.0.0|src/main/ets/pages/Index.ts:57:79)
09-08 10:36:03.405 2390-2390 C01311/AppMS com.malon…lloworld I [app_mgr_client.cpp:84]get AppMgrRemote object
09-08 10:36:03.406 2390-2390 C01311/AppMS com.malon…lloworld I [app_mgr_proxy.cpp:1333]called
09-08 10:36:03.409 2390-2390 C01317/AppKit com.malon…lloworld E [main_thread.cpp:1642]
com.malong.helloworld is about to exit due to RuntimeError
Error type:TypeError
Error name:TypeError
Error message:Cannot read property add of undefined
Stacktrace:
Cannot get SourceMap info, dump raw stack:
at anonymous (entry|entry|1.0.0|src/main/ets/pages/Index.ts:57:79)”


更多关于HarmonyOS鸿蒙Next中DAYU200刷5.1.0.106后跑native sample应用实际设备错误但是previewer正常的实战教程也可以访问 https://www.itying.com/category-93-b0.html

6 回复

cd /sys

sys/ sys_prod/ system/

cd /system/lib/

ls libstylus_innerapi.z.so

ls: libstylus_innerapi.z.so: No such file or directory 不存在, /system/lib/libstylus_innerapi.z.so 这个文件在哪?

OpenHarmony-v5.1.0-Release/OpenHarmony$ find . -name libstylus_innerapi.z.so

整个代码都不存在

更多关于HarmonyOS鸿蒙Next中DAYU200刷5.1.0.106后跑native sample应用实际设备错误但是previewer正常的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


看看开发板有没有/system/lib/libstylus_innerapi.z.so,没有的话导入后试试

09-08 15:01:42.716   2771-2771     C03f00/ArkCompiler              com.malon...lloworld  W     [default] [GetNativeOrCjsExports:50] Load native module failed, so is @normalized:Y&&&libentry.so&
09-08 15:01:42.716   2771-2771     C03f00/ArkCompiler              com.malon...lloworld  E     [default] [Call:3621] occur exception need return
09-08 15:01:42.716   2771-2771     C03f00/ArkCompiler              com.malon...lloworld  E     [ecmascript] Pending exception before ExecutePendingJob called, in line:5601, exception details as follows:
09-08 15:01:42.716   2771-2771     C03f00/ArkCompiler              com.malon...lloworld  E     TypeError: Cannot read property add of undefined
                                                                                               Cannot get SourceMap info, dump raw stack:
                                                                                                   at anonymous (entry|entry|1.0.0|src/main/ets/pages/Index.ts:57:79)
09-08 15:01:42.718   2771-2771     C01311/AppMS                    com.malon...lloworld  I     [app_mgr_client.cpp:84]get AppMgrRemote object
09-08 15:01:42.719   2771-2771     C01311/AppMS                    com.malon...lloworld  I     [app_mgr_proxy.cpp:1333]called
09-08 15:01:42.722   2771-2771     C01317/AppKit                   com.malon...lloworld  E     [main_thread.cpp:1642]
                                                                                               com.malong.helloworld is about to exit due to RuntimeError
                                                                                               Error type:TypeError
                                                                                               Error name:TypeError
                                                                                               Error message:Cannot read property add of undefined
                                                                                               Stacktrace:
                                                                                               Cannot get SourceMap info, dump raw stack:
                                                                                                   at anonymous (entry|entry|1.0.0|src/main/ets/pages/Index.ts:57:79)
09-08 15:01:42.594   2771-2771     C03f00/MUSL-LDSO                com.malon...lloworld  E     Open absolute_path library: check ns accessible failed, pathname /system/lib/libstylus_innerapi.z.so namespace ndk.
09-08 15:01:42.594   2771-2771     C03f00/MUSL-LDSO                com.malon...lloworld  E     Error loading header /system/lib/libstylus_innerapi.z.so, namespace ndk has no inherits, errno=2
09-08 15:01:42.594   2771-2771     C03f00/MUSL-LDSO                com.malon...lloworld  E     Error loading header: can't find library /system/lib/libstylus_innerapi.z.so in namespace: default
09-08 15:01:42.594   2771-2771     C03f00/MUSL-LDSO                com.malon...lloworld  E     dlopen_impl load library header failed for /system/lib/libstylus_innerapi.z.so

鸿蒙Next中DAYU200刷5.1.0.106后,native sample应用在设备上运行错误但previewer正常,可能由以下原因导致:

  1. 设备系统版本与sample应用的编译环境或依赖库版本不匹配。
  2. 设备上的系统服务或硬件驱动与sample应用的预期接口存在差异。
  3. 应用的native代码在目标设备架构(如ARM)下的兼容性问题。
  4. 设备上的安全策略或权限配置限制了应用的执行。

建议检查应用的编译日志、设备日志(如hilog)以及确保应用签名与设备授权匹配。

根据你提供的日志,问题核心在于两个层面:系统库缺失和ArkTS运行时异常。

1. 系统库缺失 (libstylus_innerapi.z.so) 日志中连续出现 Error loading header /system/lib/libstylus_innerapi.z.so 错误。这表明你刷入的 5.1.0.106 版本系统镜像可能不完整,或者该版本在DAYU200设备上存在已知的库文件缺失问题。libstylus_innerapi.z.so 是一个与手写笔输入相关的系统库,其缺失导致应用在触发点击事件时,底层动态链接失败。

2. ArkTS运行时异常 在库加载失败后,紧接着出现了ArkCompiler的异常: TypeError: Cannot read property add of undefined 堆栈指向 src/main/ets/pages/Index.ts:57:79。这通常意味着你的ETS代码(很可能是点击事件回调函数)尝试在一个 undefined 的对象上调用 .add() 方法。Previewer正常而真机崩溃,很可能是因为Previewer运行的环境与真机系统(特别是存在库缺失的真机)在Native能力绑定或运行时行为上存在差异。

问题关联 系统库的缺失可能干扰了ArkTS运行时的正常初始化或Native模块的绑定过程,从而导致你的ETS代码中预期存在的对象(可能是一个Native模块暴露的API对象)未能正确初始化,最终在调用其方法时触发 undefined 错误。

建议排查步骤

  1. 检查系统镜像:确认你下载的 5.1.0.106 镜像是否为DAYU200专用版本且完整。可以尝试重新下载或刷写另一个已知稳定的版本进行交叉验证。
  2. 审查ETS代码:重点检查 Index.ts 第57行附近的代码。确认你调用 .add() 方法的对象(例如,一个通过 import 导入的Native模块对象或一个自定义对象)是否已正确定义和初始化。检查其生命周期和导入路径。
  3. 简化测试:创建一个全新的、仅包含一个文本显示而没有任何点击事件或Native调用的纯ETS应用,部署到真机。如果此应用运行正常,则问题范围可缩小到你的特定代码逻辑与当前系统环境的兼容性上。如果同样崩溃,则系统镜像问题的可能性更大。
  4. 查看完整日志:在DevEco Studio的Log窗口中,过滤你的应用包名,查看在应用启动初期(点击事件之前)是否有其他关于模块加载或初始化的警告或错误信息。
回到顶部