Hello!
I am experiencing a strange issue in Xamarin Forms and cant find a solution.
I am trying to make a bottom tabbed page using this code:
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
and i am getting this error which cause a crash:
crc64720bb2db43a66fe9.FragmentContainer.onCreateView
FragmentContainer.java, line 33
Android.Content.Res.Resources+NotFoundException: Resource ID #0x0
Stack trace
JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args)
JniPeerMembers+JniInstanceMethods.FinishCreateInstance (System.String constructorSignature, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
Android.Support.Design.Widget.BottomNavigationView..ctor (Android.Content.Context context) [0x0007a] in <2899ffe2b3534c2b9c09eb66776436ae>:0
TabbedPageRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\TabbedPageRenderer.cs:286
VisualElementRenderer`1[TElement].SetElement (TElement element) D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:240
IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133
Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager, Android.Content.Context context) D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:397
FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:64
Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.60(intptr,intptr,intptr,intptr,intptr)
android.content.res.Resources$NotFoundException: Resource ID #0x0
android.content.res.ResourcesImpl.getValue ResourcesImpl.java:237
android.content.res.Resources.getColorStateList Resources.java:1052
android.content.Context.getColorStateList Context.java:703
android.support.v7.content.res.AppCompatResources.getColorStateList AppCompatResources.java:67
android.support.design.internal.BottomNavigationMenuView.createDefaultColorStateList BottomNavigationMenuView.java:467
android.support.design.internal.BottomNavigationMenuView.<init> BottomNavigationMenuView.java:101
android.support.design.internal.BottomNavigationMenuView.<init> BottomNavigationMenuView.java:86
android.support.design.widget.BottomNavigationView.<init> BottomNavigationView.java:123
android.support.design.widget.BottomNavigationView.<init> BottomNavigationView.java:114
android.support.design.widget.BottomNavigationView.<init> BottomNavigationView.java:110
crc64720bb2db43a66fe9.FragmentContainer.n_onCreateView(Native Method)
crc64720bb2db43a66fe9.FragmentContainer.onCreateView FragmentContainer.java:33
android.support.v4.app.Fragment.performCreateView Fragment.java:2439
android.support.v4.app.FragmentManagerImpl.moveToState FragmentManager.java:1460
android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState FragmentManager.java:1784
android.support.v4.app.FragmentManagerImpl.moveToState FragmentManager.java:1852
android.support.v4.app.BackStackRecord.executeOps BackStackRecord.java:802
android.support.v4.app.FragmentManagerImpl.executeOps FragmentManager.java:2625
android.support.v4.app.FragmentManagerImpl.executeOpsTogether FragmentManager.java:2411
android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute FragmentManager.java:2366
android.support.v4.app.FragmentManagerImpl.execPendingActions FragmentManager.java:2273
android.support.v4.app.FragmentManagerImpl.executePendingTransactions FragmentManager.java:814
crc64720bb2db43a66fe9.MasterDetailContainer.n_onAttachedToWindow(Native Method)
crc64720bb2db43a66fe9.MasterDetailContainer.onAttachedToWindow MasterDetailContainer.java:62
android.view.View.dispatchAttachedToWindow View.java:19553
android.view.ViewGroup.dispatchAttachedToWindow ViewGroup.java:3430
android.view.ViewGroup.dispatchAttachedToWindow ViewGroup.java:3437
android.view.ViewGroup.addViewInner ViewGroup.java:5149
android.view.ViewGroup.addView ViewGroup.java:4935
android.view.ViewGroup.addView ViewGroup.java:4875
android.view.ViewGroup.addView ViewGroup.java:4848
mono.java.lang.RunnableImplementor.n_run(Native Method)
mono.java.lang.RunnableImplementor.run RunnableImplementor.java:30
android.os.Handler.handleCallback Handler.java:883
android.os.Handler.dispatchMessage Handler.java:100
android.os.Looper.loop Looper.java:214
android.app.ActivityThread.main ActivityThread.java:7356
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:492
com.android.internal.os.ZygoteInit.main ZygoteInit.java:930
When i remove the SetToolbarPlacement(ToolbarPlacement.Bottom) it works as expected.
Some of the libraries:
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.3" />
Has anyone encountered this error before?