System.MissingMethodException: method "Android.Support.V4.Widget.DrawerLayout.AddDrawerListener" not found

First, I started developing Android with C # and Xamarin a week ago, and I'm stuck with this problem.

I already found some texts in Stack Overflow, but unfortunately did not work.

To solve this problem, I took several steps.

  • Before starting debugging with Android_Accelerated_x86 (Android 6.0 -API 23), Visual Studio will start searching for NavigationPageRenderer , but not there, then I got the message header above

  • I installed and updated the packages using the Android SDK Manager, as shown below.

  • Then I met a message written in the header

     System.MissingMethodException: Method Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found 

    So, I struggled to find a solution and

    • I downloaded JDK 1.8.0_101 and changed the location path of the Java Development Kit (in Tools> Options> Xamarin> Android Settings), but that didn't work. I have the same message as the title above.

    • I went to Tools> NuGet Package Manager> NuGet Package Management for the solution and updated only Xamarin.Forms v2.3.2.127. Then I got 7 errors. One of them -

      Error: package android.support.v7.internal.widget does not exist.

  • And I removed the solution and made a new project using Xamarin.Forms. I got a Warnings message like

    IDE0006 Search error while loading the project. Some project features, such as a complete analysis of solutions for a failed project and projects that depend on it, were disabled.

    and ... I received the message as the title above.

  • I also got two "Call Stack"

     0x23 in Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnAttachedToWindow at NavigationPageRenderer.cs 0xA in Android.Views.View.n_OnAttachedToWindow at Android.Views.View.cs: 

Please help me solve this problem ... Thank you very much for your attention.

+8
android c # xamarin
source share
1 answer

This problem occurs because Google has changed its support libraries in which you hooked this listener from SetDrawerListener() to AddDrawerListener() . Because of this, you will need to make sure that you are on the latest stable Xamarin.Forms. Previous versions of Xamarin.Forms that are dependent on < Android.Support 23.3 will cause this error. You can refer to this clip for more information:

https://github.com/xamarin/Xamarin.Forms/commit/d9ed63f0add8345cf6ab1508b353dcbdacbcd97c

Ideally, this should be fixed in versions of Xamarin.Forms 2.2.0.31 and higher.

https://www.nuget.org/packages/Xamarin.Forms/

+5
source share

All Articles