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

I have followed everything from the following link:
https://developer.xamarin.com/guides/xamarin-forms/user-interface/navigation/master-detail-page/
The code I wrote can be found here: http://github.com/foyzulkarim/XamarinFormsDrawer

I successfully deployed the same project in my Windows 10 Local machine using UWP project, but whenever I want to deploy in Emulator, or in my device, it is throwing the following exception.

System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found.
09-17 17:16:33.636 D/Mono    (10472): DllImport attempting to load: '/system/lib/liblog.so'.
09-17 17:16:33.637 D/Mono    (10472): DllImport loaded library '/system/lib/liblog.so'.
09-17 17:16:33.637 D/Mono    (10472): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
09-17 17:16:33.637 D/Mono    (10472): Searching for '__android_log_print'.
09-17 17:16:33.637 D/Mono    (10472): Probing '__android_log_print'.
09-17 17:16:33.637 D/Mono    (10472): Found as '__android_log_print'.
09-17 17:16:33.645 I/MonoDroid(10472): UNHANDLED EXCEPTION:
09-17 17:16:33.658 I/MonoDroid(10472): System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found.
09-17 17:16:33.658 I/MonoDroid(10472):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Platform.cs:282 
09-17 17:16:33.658 I/MonoDroid(10472):   at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\RendererFactory.cs:10 
09-17 17:16:33.658 I/MonoDroid(10472):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.AddChild (Xamarin.Forms.Page page, System.Boolean layout) [0x00015] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:248 
09-17 17:16:33.658 I/MonoDroid(10472):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x00089] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:237 
09-17 17:16:33.658 I/MonoDroid(10472):   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0009b] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:336 
09-17 17:16:33.658 I/MonoDroid(10472):   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.SetMainPage () [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:410 
09-17 17:16:33.659 I/MonoDroid(10472):   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication (Xamarin.Forms.Application application) [0x00158] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:123 
09-17 17:16:33.659 I/MonoDroid(10472):   at App1.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00018] in C:\Users\foyzu\Source\Github\XamarinForms\XamarinFormsDrawer\App1\App1\App1.Droid\MainActivity.cs:23 
09-17 17:16:33.659 I/MonoDroid(10472):   at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <71c3e52f1b484794bca1cdfb1b8b1fdb>:0 
09-17 17:16:33.659 I/MonoDroid(10472):   at (wrapper dynamic-method) System.Object:1a87dfa6-a154-49b0-925d-8ddad74d97cf (intptr,intptr,intptr)
09-17 17:16:33.677 W/art     (10472): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
09-17 17:16:33.681 D/Mono    (10472): DllImport searching in: '__Internal' ('(null)').
09-17 17:16:33.681 D/Mono    (10472): Searching for 'java_interop_jnienv_throw'.
09-17 17:16:33.681 D/Mono    (10472): Probing 'java_interop_jnienv_throw'.
09-17 17:16:33.681 D/Mono    (10472): Found as 'java_interop_jnienv_throw'.
An unhandled exception occured.

09-17 17:16:34.399 E/mono    (10472): 
09-17 17:16:34.399 E/mono    (10472): Unhandled Exception:
09-17 17:16:34.399 E/mono    (10472): System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found.
09-17 17:16:34.399 E/mono-rt (10472): [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found.
referenceTable GDEF length=814 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=47302 1

Best Answer

Answers

  • FoyzulKarimFoyzulKarim BDMember

    I tried to update only the Xamarin.Forms package from Solution level before posting the question. But this time I updated the Xamarin.Forms from package project level. Now it works. Thanks for answering.

  • MithunMMithunM USMember

    After updating the Xamarin.Forms from nuget this works fine

  • curtis.ehrhartcurtis.ehrhart ✭✭ USMember ✭✭

    seems silly you need to do this for a new project...

  • MarinosMarinos ✭✭ CYMember ✭✭
    edited November 2016

    I am having this issue too.
    When I update only the Xamarin Forms only using Nuget it appears to succeed correctly but the Android project does not build.

    I get the message:
    "Could not find a part of the path 'animated-vector-drawable-23.2.0-javadoc.jar.md5'."

    I have already posted this issue in the Visual Studio forum but with no response as yet.

  • lfajardoplfajardop PEMember

    Hello , did you get the solution?

  • EzequielRevEzequielRev USMember

    After updating the Xamarin.Forms from nuget this works fine too. Thanks for sharing !!!!

  • XanderJohnDacyonXanderJohnDacyon USMember

    @ClintStLaurent said:
    I'm going to guess you updated EVERYTHING in your Nuget manager.
    The Android support packages should NOT be updated. I know it seems like they should be, but don't.
    When you manually force them to update it will sometimes roll back your Xamarin Forms. The dependencies versus the version numbers there is all out of whack.

    Uninstall the Xamarin Forms packages and all the android support packackage.
    Reinstall just the latest Xamarin Forms Nuget package, letting it grab the Android support packages it knows it wants.
    Ignore any Android.Support.xxxx updates it displays.

    This solution worked for me.

    I uninstalled all xamarin nuget packages, restarted VS then installed xamarin forms nuget package.

    Thanks! @ClintStLaurent

  • MijaelVargasMijaelVargas USMember
    edited November 2016

    Hi
    The solution for me was to update the xamarin forms at Nuget Package in both projects, portable XAML and Android.. then I executed a clean projects in both also. And then it works.
    Good Luck

  • IshThomasIshThomas ✭✭ USMember ✭✭
    edited December 2016

    @JamesMontemagno said:
    So I just reproduced your issue and I am sorry that you and other ran into this. It looks like there was an issue in the templates and I am working with the team to quickly resolve this.

    To fix:

    • Simply right click on the android project and select "Manage Nuget Packages"
    • Go to Updates
    • Find Xamarin.Android.Support.v7.AppCompat
    • Select version 23.3.0 from the version picker and hit Install
    • You additionally will need to install the RecyclerView 23.3.0 NuGet Package. Go to Browse and search for: Xamarin.Android.Support.v7.RecyclerView and make sure to pick 23.3.0 to install for the correct version
    • Now do a full clean/rebuild and it should work
    • This should install the correct versions of everything you need for Android

    Thanks @JamesMontemagno ! This saved me. But the solution is not very good.. and clear. Of course it's temporary fix, so I'd ask you, can please explain what actually happened, how it will be fixed? (when you will know the answer of course, no rush). Today you had Dev days presentation and every thing works (although I could watch only first two sections - great job btw!), did you also run into this problem and had to update to 23.3.0?

  • TroyScottTroyScott CAMember

    I updated the the packages (Nugget Manager) to the latest version for Xamarin.Forms and Android. This still resulted in a compile error related to the version of the Java SDK (1.7.0_55).

    "Warning major version 52 is newer than 51, the highest major version supported by this compiler"

    I updated the Java SDK to 1.8.0_121 in the Xamarin Options (Xamarin > Android Settings > Java Development Kit Location). Cleaned the solutions and then Build the solution inn Visual Studio. Works. Thanks for the suggestions.

    Issue occurred while going through an example that uses the NavigationPage.

  • anish_palanish_pal ✭✭ INMember ✭✭

    After updating the altest Xamarin.Forms from nuget this works fine.

Sign In or Register to comment.