Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button component crashes app with NullReferenceException on Android 11 #15

Open
johnnyegel opened this issue Mar 22, 2021 · 1 comment
Labels
bug Something isn't working question Further information is requested

Comments

@johnnyegel
Copy link

I've tested this on a Samsung Galaxy S10+ and in the Android Emulator (using a pixel). The app crashes with a NullReferenceException, seemingly unrelated to the code in my app (nor the Material Design library). Looking into the Xamarin Android code involved in the exception, it seems there is no renderer available when it tries to render the button component.

The app is build for Android 11 set as target android API (API Level 30).

Here is the XAML to reproduce:

<material:MaterialButton Text="TestButton" />

If I remove that tag from the XAML, the app works fine once more.

And here is the complete exception with full stacktrace:

03-22 11:14:59.642 D/AndroidRuntime( 2538): Shutting down VM
--------- beginning of crash
03-22 11:14:59.642 E/AndroidRuntime( 2538): FATAL EXCEPTION: main
03-22 11:14:59.642 E/AndroidRuntime( 2538): Process: no.smartly.droid.DevBuild, PID: 2538
03-22 11:14:59.642 E/AndroidRuntime( 2538): android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
03-22 11:14:59.642 E/AndroidRuntime( 2538):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0002b] in <04c545f414d24a37af95d995791bb9a9>:0 
03-22 11:14:59.642 E/AndroidRuntime( 2538):   at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00024] in <04c545f414d24a37af95d995791bb9a9>:0 
03-22 11:14:59.642 E/AndroidRuntime( 2538):   at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00008] in <bd479d16d3e64f0c97b097008ae63a7f>:0 
03-22 11:14:59.642 E/AndroidRuntime( 2538):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.21(intptr,intptr,bool,int,int,int,int)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at crc643f46942d9dd1fff9.PlatformRenderer.n_onLayout(Native Method)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at crc643f46942d9dd1fff9.PlatformRenderer.onLayout(PlatformRenderer.java:63)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.View.layout(View.java:22844)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewGroup.layout(ViewGroup.java:6389)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.View.layout(View.java:22844)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewGroup.layout(ViewGroup.java:6389)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.View.layout(View.java:22844)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewGroup.layout(ViewGroup.java:6389)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.View.layout(View.java:22844)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewGroup.layout(ViewGroup.java:6389)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.View.layout(View.java:22844)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewGroup.layout(ViewGroup.java:6389)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.View.layout(View.java:22844)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewGroup.layout(ViewGroup.java:6389)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at com.android.internal.policy.DecorView.onLayout(DecorView.java:784)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.View.layout(View.java:22844)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewGroup.layout(ViewGroup.java:6389)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3470)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2938)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.Choreographer.doCallbacks(Choreographer.java:796)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.Choreographer.doFrame(Choreographer.java:731)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.os.Handler.handleCallback(Handler.java:938)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.os.Looper.loop(Looper.java:223)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at java.lang.reflect.Method.invoke(Native Method)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
03-22 11:14:59.642 E/AndroidRuntime( 2538): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
@agaldanaw2 agaldanaw2 added the bug Something isn't working label May 7, 2021
@AgustinBonilla
Copy link
Collaborator

Hi @johnnyegel! I wanted to ask if you're still experiencing issues with our Button control and if you've had a chance to validate the new V3 version of the button control (available in the latest release). This new version has many improvements and fixes compared to the one shown in the example you sent us. We would love to receive your feedback on the new version.
Thank you for your time and support in using our library!

@AgustinBonilla AgustinBonilla added the question Further information is requested label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants