English 中文(简体)
MAUI Error inflating category com.google.androidmaterial.appbar.App BarLayout
原标题:MAUI Error inflating class com.google.android.material.appbar.AppBarLayout

我已根据文件样本“Xaminals”撰写了一份MAUI数据。 它汇编了罚款,但在安乐器的初始化时,我有以下例外:

Android.Views.InflateException

Message.companyname.shvn_guide:layout/flyoutcontent: Binary XML file Line #1 in com.companyname.shvn_guide:layout/flyoutcontent: Error inflating category com.google.androidmaterial.appbar.AppBarLayout

Stack trace

0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception C# 0x1A in Android.Runtime.JNINativeWrapper.unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5 C# 0x1E in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:122,26 C# 0x17 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw C# 0x69 in Java.Interop.JniEnvironment.InstanceMethods.CallObjectMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:11524,5 C# 0x3E in Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualObjectMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:867,7 C# 0x4B in Android.Views.LayoutInflater.Inflate at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.LayoutInflater.cs:661,5 C# 0x2B in Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer.LoadView at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellFlyoutTemplatedContentRenderer.cs:78,4 C# 0x2B in Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer..ctor at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellFlyoutTemplatedContentRenderer.cs:60,4 C# 0x1 in Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer.CreateShellFlyoutContentRenderer at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellRenderer.cs:144,4 C# 0x1 in Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer.Microsoft.Maui.Controls.Platform.Compatibility.IShellContext.CreateShellFlyoutContentRenderer at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellRenderer.cs:49,4 C# 0x1C in Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutRenderer.AddFlyoutContentToLayoutIfNeeded at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellFlyoutRenderer.cs:249,5 C# 0x68 in Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutRenderer.AttachFlyout at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellFlyoutRenderer.cs:231,5 C# 0x3 in Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutRenderer.Microsoft.Maui.Controls.Platform.Compatibility.IShellFlyoutRenderer.AttachFlyout at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellFlyoutRenderer.cs:64,4 C# 0x55 in Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer.OnElementSet at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellRenderer.cs:211,4 C# 0x1B in Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer.SetVirtualView at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellRenderer.cs:194,4 C# 0x7 in Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer.Microsoft.Maui.IElementHandler.SetVirtualView at D:a_work1ssrcControlssrcCoreCompatibilityHandlersShellAndroidShellRenderer.cs:302,4 C# 0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:a_work1ssrcControlssrcCoreHandlerImplElementElement.Impl.cs:69,6 C# 0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:a_work1ssrcControlssrcCoreHandlerImplElementElement.Impl.cs:19,11 C# 0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:a_work1ssrcControlssrcCoreHandlerImplVisualElementVisualElement.Impl.cs:305,5 C# 0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:a_work1ssrcCoresrcPlatformElementExtensions.cs:96,4 C# 0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:a_work1ssrcCoresrcPlatformElementExtensions.cs:127,4 C# 0x5F in Microsoft.Maui.Platform.ContainerView.SetView at D:a_work1ssrcCoresrcPlatformAndroidContainerView.cs:72,5 C# 0x3 in Microsoft.Maui.Platform.ContainerView.set_CurrentView at D:a_work1ssrcCoresrcPlatformAndroidContainerView.cs:51,11 C# 0x8 in Microsoft.Maui.Platform.ElementExtensions.ToContainerView at D:a_work1ssrcCoresrcPlatformAndroidElementExtensions.cs:11,4 C# 0x1F in Microsoft.Maui.Platform.NavigationRootManager.Connect at D:a_work1ssrcCoresrcPlatformAndroidNavigationNavigationRootManager.cs:56,5 C# 0x26 in Microsoft.Maui.Handlers.WindowHandler.CreateRootViewFromContent at D:a_work1ssrcCoresrcHandlersWindowWindowHandler.Android.cs:79,4 C# 0x15 in Microsoft.Maui.Handlers.WindowHandler.MapContent at D:a_work1ssrcCoresrcHandlersWindowWindowHandler.Android.cs:24,4 C# 0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.IWindow,Microsoft.Maui.Handlers.IWindowHandler>. at D:a_work1ssrcCoresrcPropertyMapper.cs:172,6 C# 0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:a_work1ssrcCoresrcPropertyMapper.cs:47,4 C# 0x1D in Microsoft.Maui.PropertyMapper.UpdateProperties at D:a_work1ssrcCoresrcPropertyMapper.cs:82,5 C# 0xCB in Microsoft.Maui.Handlers.ElementHandler.SetVirtualView at D:a_work1ssrcCoresrcHandlersElementElementHandler.cs:79,4 C# 0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:a_work1ssrcControlssrcCoreHandlerImplElementElement.Impl.cs:69,6 C# 0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:a_work1ssrcControlssrcCoreHandlerImplElementElement.Impl.cs:19,11 C# 0xA2 in Microsoft.Maui.Platform.ElementExtensions.SetHandler at D:a_work1ssrcCoresrcPlatformElementExtensions.cs:156,4 C# 0x3 in Microsoft.Maui.Platform.ElementExtensions.SetWindowHandler at D:a_work1ssrcCoresrcPlatformElementExtensions.cs:166,4 C# 0x79 in Microsoft.Maui.Platform.ApplicationExtensions.CreatePlatformWindow at D:a_work1ssrcCoresrcPlatformAndroidApplicationExtensions.cs:46,4 C# 0x54 in Microsoft.Maui.MauiAppCompatActivity.OnCreate at D:a_work1ssrcCoresrcPlatformAndroidMauiAppCompatActivity.cs:32,4 C# 0x11 in Android.App.Activity.n_OnCreate_Landroid_os_Bundle at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.App.Activity.cs:2816,4 C# 0x9 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:121,5 C#

Environment

Windows 10 Pro 19045.3324 16 GB RAM Visual Studio Community Ed. 17.7.3 .NET 7.0 Emulator Pixel 5 API - 33 (Android 13 - API 33)

The error message and stack trace above is all info I get from Visual Studio. I have found no relevant info on Internet. A similar app written for Xamarin did NOT cast this exception. I would appreciate any info on this problem.

问题回答

我已根据文件样本“Xaminals”撰写了一份MAUI数据。 为Xamarin撰写的类似材料中,NOT表示这一例外。

You mean that you made a MAUI app with reference to this: Xaminals (xamarin-forms-samples)? If so, You need to notice that Xamarin s project is a bit different from MAUI s. For more info about it, you can refer to the official doc: Migrate from Xamarin.

You can directly use this code sample:Xaminals (maui-samples). I tested it, and it works well.





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签