Rg.Plugins.Popup icon indicating copy to clipboard operation
Rg.Plugins.Popup copied to clipboard

NullReferenceException in Android MainActivity

Open lolohouse opened this issue 6 years ago • 2 comments

When run app in Android (in IOS does not happen) in the code :

protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(savedInstanceState);

        global::Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
        global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

        LoadApplication(new App());    <---- ERRR
    }

This error in console is : MonoDroid] UNHANDLED EXCEPTION: [MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object. [MonoDroid] at Rg.Plugins.Popup.Droid.Renderers.PopupPageRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0006b] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup.Droid\Renderers\PopupPageRenderer.cs:80 [MonoDroid] at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean p0, System.Int32 p1, System.Int32 p2, System.Int32 p3, System.Int32 p4) [0x00008] in D:\a\1\s\Xamarin.Forms.Platform.Android.FormsViewGroup\obj\Release\generated\src\Xamarin.Forms.Platform.Android.FormsViewGroup.cs:198 [MonoDroid] at (wrapper dynamic-method) System.Object.32(intptr,intptr,bool,int,int,int,int) [art] JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable [Mono] DllImport searching in: '__Internal' ('(null)'). [Mono] Searching for 'java_interop_jnienv_throw'. [Mono] Probing 'java_interop_jnienv_throw'. [Mono] Found as 'java_interop_jnienv_throw'. [MonoDroid] UNHANDLED EXCEPTION: [MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object. [MonoDroid] at (wrapper dynamic-method) System.Object.32(intptr,intptr,bool,int,int,int,int) [MonoDroid] at (wrapper native-to-managed) System.Object.32(intptr,intptr,int,int,int,int,int)

lolohouse avatar Dec 05 '18 12:12 lolohouse

I found the problem ... In method OnLayout get RootWindowInsets but get null and Crash.. !¡ I have Android version 25 and the RootWindowInsets insert in android version 23, but get null.. (I think it's a mistake by Xamarin)

I have created one customrenderer but not override the customrenderer of popuprender ?¿

lolohouse avatar Dec 05 '18 12:12 lolohouse

@lolohouse What device did you use to get this exception? RootWindowInsets can't be null for devices with >= API 23.

Give me more information about the device, xamarin, xamarin.forms and etc.

rotorgames avatar Jan 18 '19 03:01 rotorgames