我有一个 Mauiapp,我在物理 Android 设备上调试和测试它。我一直没有遇到任何问题,但现在当我切换到应用程序的两侧时,它崩溃了。崩溃仅出现在发布模式下,而不是在调试时出现。如前所述,它仅在弹出菜单的两侧崩溃,所有其他侧面和弹出菜单侧面都可以完美工作。
我现在真的不知道该怎么办,因为我没有任何错误消息或错误出现的提示。
我已经尝试删除 obj 和 bin 文件夹或清理并重建项目。
如果您需要代码的任何部分或其他内容,请写评论并感谢您的帮助!
更新
使用 Logcat 后,我发现这些条目可能是一个很好的线索:
Time Device Name Type PID Tag Message
03-31 10:39:49.845 Samsung SM-A546E Verbose 1310 WindowManager Setting visibility of Window{d8681d9 u0 com.engelberthdeveloping.passwortapp/crc6451514aa4f2d5798b.MainActivity EXITING}: false, caller=com.android.server.wm.WindowContainer.sendAppVisibilityToClients:1281 com.android.server.wm.WindowToken.setClientVisible:447 com.android.server.wm.ActivityRecord.setClientVisible:7988 com.android.server.wm.ActivityRecord.postApplyAnimation:6593 com.android.server.wm.ActivityRecord.commitVisibility:6536
Time Device Name Type PID Tag Message
03-31 10:39:49.845 Samsung SM-A546E Warning 1310 WindowManager Exception thrown during dispatchAppVisibility Window{d8681d9 u0 com.engelberthdeveloping.passwortapp/crc6451514aa4f2d5798b.MainActivity EXITING}
Time Device Name Type PID Tag Message
03-31 10:39:49.845 Samsung SM-A546E Warning 1310 WindowManager android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:662)
at android.view.IWindow$Stub$Proxy.dispatchAppVisibility(IWindow.java:631)
at com.android.server.wm.WindowState.sendAppVisibilityToClients(WindowState.java:3982)
at com.android.server.wm.WindowContainer.sendAppVisibilityToClients(WindowContainer.java:1281)
at com.android.server.wm.WindowToken.setClientVisible(WindowToken.java:447)
at com.android.server.wm.ActivityRecord.setClientVisible(ActivityRecord.java:7988)
at com.android.server.wm.ActivityRecord.postApplyAnimation(ActivityRecord.java:6593)
at com.android.server.wm.ActivityRecord.commitVisibility(ActivityRecord.java:6536)
at com.android.server.wm.Transition.finishTransition(Transition.java:1400)
at com.android.server.wm.TransitionController.finishTransition(TransitionController.java:1036)
at com.android.server.wm.WindowOrganizerController.finishTransition(WindowOrganizerController.java:429)
at android.window.IWindowOrganizerController$Stub.onTransact(IWindowOrganizerController.java:286)
at com.android.server.wm.WindowOrganizerController.onTransact(WindowOrganizerController.java:207)
at android.os.Binder.execTransactInternal(Binder.java:1380)
at android.os.Binder.execTransact(Binder.java:1311)
Time Device Name Type PID Tag Message
03-31 10:39:49.845 Samsung SM-A546E Info 1310 Process Sending signal. PID: 28268 SIG: 9
Time Device Name Type PID Tag Message
03-31 10:39:49.846 Samsung SM-A546E Verbose 1310 WindowManager Remove Window{d8681d9 u0 com.engelberthdeveloping.passwortapp/crc6451514aa4f2d5798b.MainActivity EXITING}: mSurfaceController=Surface(name=com.engelberthdeveloping.passwortapp/crc6451514aa4f2d5798b.MainActivity$_28268)/@0x3fdc60a mAnimatingExit=true mRemoveOnExit=true mHasSurface=true surfaceShowing=true animating=false app-animation=false mDisplayFrozen=false callers=com.android.server.wm.WindowToken.removeAllWindowsIfPossible:258 com.android.server.wm.ActivityRecord.removeIfPossible:5063 com.android.server.wm.ActivityRecord.handleCompleteDeferredRemoval:5070 com.android.server.wm.WindowContainer.handleCompleteDeferredRemoval:1456 com.android.server.wm.TaskFragment.handleCompleteDeferredRemoval:3345 com.android.server.wm.WindowContainer.handleCompleteDeferredRemoval:1456
Time Device Name Type PID Tag Message
03-31 10:39:49.847 Samsung SM-A546E Info 1310 WindowManager Destroying surface Surface(name=com.engelberthdeveloping.passwortapp/crc6451514aa4f2d5798b.MainActivity$_28268)/@0x3fdc60a called by com.android.server.wm.WindowStateAnimator.destroySurface:789 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:472 com.android.server.wm.WindowState.removeImmediately:2904 com.android.server.wm.WindowState.removeIfPossible:3140 com.android.server.wm.WindowToken.removeAllWindowsIfPossible:258 com.android.server.wm.ActivityRecord.removeIfPossible:5063 com.android.server.wm.ActivityRecord.onRemovedFromDisplay:5145 com.android.server.wm.ActivityRecord.removeImmediately:5053
我终于找到了解决办法。经过一些研究,我发现 android.os.DeadObjectException 是 Java 异常的一部分。因此,我在 VS 异常设置中激活了 Java 异常、JavaScript 异常和 JavaScript 运行时异常。之后我得到了以下异常:
Microsoft.Maui.Controls.Xaml.XamlParseException:'位置 49:75。找不到关键 MobileText 的 StaticResource'
我忘记从标签中删除 styleguid,该标签已在 Style.xaml 中删除。所以解决这个问题很简单:
只需从标签中删除样式,之后一切正常。
非常感谢 Dan Gerchcovich 对我的大力支持。我也给他投了赞成票,因为他有想法查看 logcat,我们在其中发现了 android.os.DeadObjectException。