HarmonyOS鸿蒙Next中运行示例程序不能实现页面跳转

HarmonyOS鸿蒙Next中运行示例程序不能实现页面跳转

I/HwPartPowerOfficeFactory: add HwPartPowerOfficeFactoryImpl to memory.
D/InputEventReceiver: dispatchInputInterval 0
E/RtgSchedIpcFile: RtgSchedIpcFile failed to open /proc/1018/rtg
I/RmeSchedManager: init Rme, version is: v1.0
E/RtgSchedIpcFile: setCommandByIoctl not opened
D/RtgSched: resetRtgSchedHandle failed enable:1
D/OpenGLRenderer: disableOutlineDraw is true
E/RtgSchedIpcFile: setCommandByIoctl not opened
W/HiTouch_HiTouchSensor: depended package hiTouch does n't exist!
I/HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don't exist.
D/HiTouch_PressGestureDetector: onAttached, package=com.example.myapplication, windowType=1, mHiTouchRestricted=true
D/RtgSched: resetRtgSchedHandle failed enable:1
I/iGraphics: [0020080c] pn: com.example.myapplication, p: 1018
[0030080c] no spt app: com.example.myapplication
I/FrameFlow: FrameFlowInit app is not supported by frameflow solution
D/: HostConnection::get() New Host Connection established 0x73f8497540, tid 1076
I/RenderThread: type=1400 audit(0.0:12257): avc: denied { read write } for pid=1018 name="goldfish_pipe" dev="tmpfs" ino=3689 scontext=u:r:untrusted_app:s0:c49,c256,c512,c768 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1
D/AGP: ReSubscribeCachedEvents .
MMI: UIView::SubscribeVoiceEvents
BF:Client register new ability
W/e.myapplicatio: Call to JNI FindClass with dots in name: "ohos.accessibility.AccessibilitySystemAbilityClient"
D/AGP: BF:Client Register
ReSubscribeCachedEvents .
MMI: UIView::SubscribeVoiceEvents
ReSubscribeCachedEvents .
MMI: UIView::SubscribeVoiceEvents
ReSubscribeCachedEvents .
MMI: UIView::SubscribeVoiceEvents
ReSubscribeCachedEvents .
MMI: UIView::SubscribeVoiceEvents
I/FrameFlow: FrameFlowInit app is not supported by frameflow solution
D/: HostConnection::get() New Host Connection established 0x73ea54b5e0, tid 1108
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/EGL_emulation: eglCreateContext: 0x73f8455160: maj 3 min 0 rcv 3
D/AGP: Surface created: width:466, height:466
D/EGL_emulation: eglMakeCurrent: 0x73f8455160: ver 3 0 (tinfo 0x73f84f3420)
D/EGL_emulation: eglCreateContext: 0x73ea4d2fe0: maj 3 min 0 rcv 3
W/Gralloc3: mapper 3.x is not supported
D/HAL: loaded HAL id=gralloc path=/vendor/lib64/hw/gralloc.ranchu.so hmi=0x73985ed010 handle=0xa48f365b24991547
D/HwForceDark: [SetDarkThemeInfo] enable = [0], appType = [0], winWidth = [466]
D/EGL_emulation: eglMakeCurrent: 0x73ea4d2fe0: ver 3 0 (tinfo 0x73ea4d9280)
D/EGL_emulation: eglMakeCurrent: 0x73f8455160: ver 3 0 (tinfo 0x73f84f3420)
E/EGL_emulation: eglQuerySurface 313d EGL_BAD_ATTRIBUTE
I/HwViewRootImpl: removeInvalidNode jank list is null
D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W/InputMethodManager: startInputReason = 1
E/AGP: can not find focus
W/FastPrintWriter: Write failure
java.io.IOException: write failed: EPIPE (Broken pipe)
    at libcore.io.IoBridge.write(IoBridge.java:544)
    at java.io.FileOutputStream.write(FileOutputStream.java:392)
    at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:354)
    at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:377)
    at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:412)
    at android.app.ActivityThread.handleDumpActivity(ActivityThread.java:4741)
    at android.app.ActivityThread.access$3600(ActivityThread.java:251)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2390)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:219)
    at android.app.ActivityThread.main(ActivityThread.java:8380)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1083)
Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe)
    at libcore.io.Linux.writeBytes(Native Method)
    at libcore.io.Linux.write(Linux.java:294)
    at libcore.io.ForwardingOs.write(ForwardingOs.java:241)
    at libcore.io.BlockGuardOs.write(BlockGuardOs.java:416)
    at libcore.io.ForwardingOs.write(ForwardingOs.java:241)
    at libcore.io.IoBridge.write(IoBridge.java:539)
    at java.io.FileOutputStream.write(FileOutputStream.java:392) 
    at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:354) 
    at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:377) 
    at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:412) 
    at android.app.ActivityThread.handleDumpActivity(ActivityThread.java:4741) 
    at android.app.ActivityThread.access$3600(ActivityThread.java:251) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2390) 
    at android.os.Handler.dispatchMessage(Handler.java:110) 
    at android.os.Looper.loop(Looper.java:219) 
    at android.app.ActivityThread.main(ActivityThread.java:8380) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1083) 
E/e.myapplicatio: GcSupervisor: parse parameters failed

更多关于HarmonyOS鸿蒙Next中运行示例程序不能实现页面跳转的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

亲爱滴开发者 ,这个问题已经在处理中啦,稍后答复你哟 ,么么哒

更多关于HarmonyOS鸿蒙Next中运行示例程序不能实现页面跳转的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


已解决,谢谢你了。

问题原因是把

```java
Operation operation = Intent.OperationBuilder()
    .withDeviceId("")
    .withBundleName("com.example.myapplication")
    .withAbilityName("com.example.myapplication.SecondAbility")
    .build();

写成
Operation operation = new Intent.OperationBuilder()
    .withDeviceId("")
    .withBundleName("com.example.myapplication")
    .withAbilityName("com.example.myapplication. SecondAbility")
    .build();
在 SecondAbility前多了一个空格,编译时没发现。

在HarmonyOS鸿蒙Next中,如果示例程序无法实现页面跳转,可能的原因包括以下几个方面:

  1. 页面路由配置错误:检查config.jsonmodule.json文件中的路由配置是否正确,确保目标页面已正确注册。

  2. 页面路径错误:在调用router.pushrouter.replace方法时,确认传入的路径与配置文件中定义的路径一致。

  3. 页面生命周期问题:确保目标页面的生命周期方法(如onPageShowonPageHide)没有阻止页面跳转的逻辑。

  4. 权限问题:某些页面跳转可能需要特定的权限,检查是否已正确申请并授予相关权限。

  5. 资源加载问题:如果目标页面依赖的资源未正确加载,可能导致跳转失败,检查资源文件是否存在且路径正确。

  6. 代码逻辑错误:检查跳转逻辑代码,确保没有语法错误或逻辑错误导致跳转失败。

  7. 系统版本兼容性:确认示例程序与当前鸿蒙Next系统版本兼容,某些API或功能可能在特定版本中不可用。

  8. 调试信息:通过日志或调试工具查看跳转过程中的错误信息,定位具体问题。

以上是可能导致页面跳转失败的常见原因,需逐一排查。

在HarmonyOS鸿蒙Next中,页面跳转问题可能由以下原因导致:

  1. 路由配置错误:检查config.json中的路由配置,确保目标页面路径正确。
  2. 页面路径错误:确认router.pushrouter.replace中的路径与配置一致。
  3. 页面未注册:确保目标页面已在pages数组中注册。
  4. 生命周期问题:检查页面生命周期方法,确保跳转逻辑在正确时机执行。
  5. 权限问题:确认应用具备跳转权限。

建议逐步排查以上问题,确保配置和代码无误。

回到顶部