Issue after upgrading v4 Support Library

Hi all !

I have an issue after upgrading my v4 Support Library Package From v21 to v22.

My app crashes when trying to use a Custom Renderer inheriting from ListViewRenderer. It worked perfectly before upgrade.

I tried to upgrade my SDKs through the Android SDK Manager but it doesn't solve my problem.

Thanks a lot !

Here is the exception :

[MonoDroid] System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.StartCreateInstance'.
[MonoDroid] at Xamarin.Forms.Platform.Android.ListViewRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs1 e) [0x00000] in <filename unknown>:0 [MonoDroid] at PicardInventaire.Droid.Renderers.NoLongPressListViewRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs1 e) [0x00001] in c:\DEV\Xamarin Projects\PicardInventaire\Droid\Renderers\NoLongPressListView.cs:18
[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.ListView].SetElement (Xamarin.Forms.ListView element) [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.ListView].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, Boolean sameChildren) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.View].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.View].SetElement (Xamarin.Forms.View element) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.View].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, Boolean sameChildren) [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.Page].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.Page].SetElement (Xamarin.Forms.Page element) [0x00000] in <filename unknown>:0 [MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer1[Xamarin.Forms.Page].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.NavigationRenderer.SwitchContentAsync (Xamarin.Forms.Page view, Boolean animated, Boolean removed) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.NavigationRenderer.OnPushAsync (Xamarin.Forms.Page view, Boolean animated) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.NavigationRenderer.PushViewAsync (Xamarin.Forms.Page page, Boolean animated) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.NavigationRenderer.OnPushed (System.Object sender, Xamarin.Forms.NavigationRequestedEventArgs e) [0x00000] in :0
[MonoDroid] at Xamarin.Forms.NavigationPage+d__16.MoveNext () [0x00000] in :0
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in :0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in :0
[MonoDroid] at Xamarin.Forms.NavigationPage+d__11.MoveNext () [0x00000] in :0
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in :0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in :0
[MonoDroid] at PicardInventaire.Pages.LoginPage+d__3.MoveNext () [0x0022e] in c:\DEV\Xamarin Projects\PicardInventaire\PicardInventaire\Pages\LoginPage.xaml.cs:49

Best Answer

Answers

  • In fact the issue is still here with the Standard ListView Renderer :

     Missing method Android.Runtime.JNIEnv::StartCreateInstance(Type,string,JValue*) in assembly Mono.Android.dll, referenced in assembly /storage/sdcard0/Android/data/PicardInventaire.Droid/files/.__override__/Xamarin.Android.Support.v4.dll
    
  • MauroCasuMauroCasu CAMember ✭✭

    I have exactly the same issue. A project using Master/Detail crashes after the update with the same error of missing method StartCreateInstance:

    System.Diagnostics.Debugger.Mono_UnhandledException_internal () in
    System.Diagnostics.Debugger.Mono_UnhandledException (ex={System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.StartCreateInstance'.
    at Xamarin.Forms.Platform.Android.MasterDetailRenderer..ctor ()

    The project worked perfectly before the upgrade.

    Thanks,
    Mauro

  • MitchMilamMitchMilam USMember ✭✭✭

    @EmmanuelGonzalez, @MauroCasu can you run a Build, Clean operation, then Rebuild All to see if that fixes the issue?

    I've recently seen some of the updates to the codebase require a complete fresh build of your application.

  • MauroCasuMauroCasu CAMember ✭✭

    Hi Mitch,
    I have tried to clean all and rebuild but same issue. The only way I have found to fix it, is to downgrade Xamarin.Android.Support.V4 from version 22.1.1 to ver 22.0.0.
    I am using Xamarin Studio 5.8.3 on a Mac.

    Thanks,
    Mauro

  • tkowalczyktkowalczyk PLMember, University ✭✭

    The same error here, how to fix it? anybody from Xamarin already know about this?
    @TheRealJasonSmith @CraigDunn

  • WernerKuhnleWernerKuhnle DEMember

    I've the same error with the latest Grid Demo Sample from DevExpress (for their latest version 15.1.3 of DevExpress Grid for Xamarin Forms; version 15.1.2 worked).
    Could not find a solution for this until now ..

  • ChWoChWo DEMember

    Same error here. An App with a Master-Detail-Page crashes on LoadApplication with that error.

  • Info-FrameLtdInfo-FrameLtd HUMember ✭✭

    Same issue here. LoadApplication crashes with mscorlib issues.

  • billvbillv USMember

    I'm also seeing the issue with the MasterDetailPage

  • FelipeOliveiraFelipeOliveira USMember

    Same issue here

  • DavidCarassoDavidCarasso FRMember

    Same issue as well here. With MasterDetailPage.

  • TerrellCheavesTerrellCheaves USMember

    Same issue with me when using MasterDetailPage. LoadApplication is throwing:

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.StartCreateInstance'.
    [mono] at Xamarin.Forms.Platform.Android.MasterDetailRenderer..ctor () [0x00000] in :0
    [mono] at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
    [mono] at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in :0

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @MauroCasu How do you downgrade to v22.0.0? On Mac I don't find any option in the 'Add Packages' window.

  • MauroCasuMauroCasu CAMember ✭✭

    @ShantimohanElchuri To downgrade a package on Xamarin Studio for Mac, you can just add the same package again with the keyword "version:" at the end, like this:
    Xamarin.Android.Support.V4 version:

    It will show to you all the available versions for this package and then, if you add it again (with a previous version), it will be replaced.
    Consider that some packages have dependencies and you are sometimes required to downgrade other packages as well.

    Mauro

  • MauroCasuMauroCasu CAMember ✭✭

    @ShantimohanElchuri Sorry in my previous post I forgot a star () at the end of the keyword "version:", the right example is this:
    Xamarin.Android.Support.V4 version:

    Mauro

  • MauroCasuMauroCasu CAMember ✭✭

    @ShantimohanElchuri Looking at my previous posts, in my browser the star does not appear... :( anyway, if you don't see it, just add a star after the colon at the end of the version keyword.

    Mauro

  • IanJonesIanJones AUUniversity ✭✭

    I'm getting the same issue at LoadApplication(...) with X.Forms v1.4.2.6355 and X.Android.Support.v4 v22.0.0.0
    Error dump and system config attached.

  • MauroCasuMauroCasu CAMember ✭✭

    I have tried the new version of the package (22.1.1.1) and now the issue seems correctly fixed.

    Thanks,
    Mauro

  • EmilOlssonEmilOlsson USMember

    I just had the same issue with the latest nugets of both xamarin forms and Android.Support.v4. However after many hours of head scratching I tried to upgrade xamarins visual studio plugin. It weirdly worked after that?!?!?

Sign In or Register to comment.