Skip to content

Java.Lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.ColorStateList com.google.android.material.navigation.NavigationBarMenuView.getItemTextColor()' on a null object reference #9691

Open
@LeoJHarris

Description

Android framework version

net9.0-android

Affected platform version

Version 17.12.4

Description

Running our app in Release Configuration with r8 enabled is throwing the following exception as per the logcat, when r8 is disabled we don't get the crash.

Steps to Reproduce

Running the app in Release config with r8 enabled and run the app... crash,

Did you find any workaround?

Disabling r8

Relevant log output

Time	Device Name	Type	PID	Tag	Message
01-17 15:49:34.695	Samsung SM-G991U	Info	12591	MonoDroid	Java.Lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.ColorStateList com.google.android.material.navigation.NavigationBarMenuView.getItemTextColor()' on a null object reference
   at Java.Interop.JniEnvironment.InstanceMethods.CallObjectMethod(JniObjectReference instance, JniMethodInfo method, JniArgumentValue* args)
   at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualObjectMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters)
   at Google.Android.Material.Navigation.NavigationBarView.get_ItemTextColor()
   at Microsoft.Maui.Controls.Handlers.TabbedPageManager.GetItemTextColorStates()
   at Microsoft.Maui.Controls.Handlers.TabbedPageManager.UpdateBarTextColor()
   at Microsoft.Maui.Controls.Handlers.TabbedPageManager.UpdateTabItemStyle()
   at Microsoft.Maui.Controls.TabbedPage.MapBarTextColor(ITabbedViewHandler handler, TabbedPage view)
   at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass2_0`2[[Microsoft.Maui.Controls.TabbedPage, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.ITabbedViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<ReplaceMapping>b__0(ITabbedViewHandler h, TabbedPage v, Action`2 p)
   at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass1_0`2[[Microsoft.Maui.Controls.TabbedPage, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.ITabbedViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<ModifyMapping>g__newMethod|0(IElementHandler handler, IElement view)
   at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.ITabbedView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.ITabbedViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v)
   at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
   at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ITabbedView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Android.Views.View, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].SetVirtualView(IView view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ITabbedView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Android.Views.View, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].SetVirtualView(IElement view)
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
   at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
   at Microsoft.Maui.Platform.ScopedFragment.OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
   at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState)
   at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L(_JniMarshal_PPLLL_L callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, IntPtr p1, IntPtr p2)
  --- End of managed Java.Lang.NullPointerException stack trace ---

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions