Xamarin forms to Maui error inflating AppBarLayout android

Jerod Motley 0 Reputation points
2023-11-02T23:15:40.3166667+00:00

I updated a Xamarin Forms app to Maui in VS22 targetting .net7 and android 33. We only care about the android version. I used the migration assistant to update the project, then added the files to a new, empty Maui project. It builds successfully now. After the splash screen goes away I get the error below that eventually leads to the error inflating AppBarLayout. I have no idea where the problem is, so I'm not sure what code to post.

Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f040100 a=-1}, theme={InheritanceMap=[id=0x7f120263com.app.trustqa:style/ThemeOverlay.AppCompat.Dark.ActionBar, id=0x7f120074com.app.trustqa:style/Base.ThemeOverlay.AppCompat.Dark.ActionBar, id=0x7f120073com.app.trustqa:style/Base.ThemeOverlay.AppCompat.Dark, id=0x7f12013ecom.app.trustqa:style/Platform.ThemeOverlay.AppCompat.Dark, id=0x7f12013dcom.app.trustqa:style/Platform.ThemeOverlay.AppCompat], Themes=[com.app.trustqa:style/ThemeOverlay.AppCompat.Dark.ActionBar, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced, com.app.trustqa:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]} Android.Views.InflateException Message=Binary XML file line #1 in com.app.trustqa:layout/navigationlayout: Binary XML file line #1 in com.app.trustqa:layout/navigationlayout: Error inflating class com.google.android.material.appbar.AppBarLayout

Any ideas?

Developer technologies | .NET | .NET MAUI
{count} votes

1 answer

Sort by: Most helpful
  1. yamataka 0 Reputation points
    2023-12-22T02:32:25.6866667+00:00

    I had the same problem too. After investigating for several days, I found that the following was the problem.

    After returning "Thema" of "MainActivity" to the default setting, the problem no longer occurs.

    Theme = "@style/Maui.SplashTheme" 
    

    It seems like you can't change Thema in MAUI.

    https://learn.microsoft.com/en-us/answers/questions/1027273/where-does-the-style-file-that-defines-the-maui-sp

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.