0
votes

We have a Xamarin.Forms app which runs fine in general, but we've started getting the following reported in Insights:

Java.Interop.JniEnvironmentAnimators may only be run on Looper threads

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<0fb81fca302d41cc8bea1069ded33ca9>:0 Java.Interop.JniEnvironment.InstanceMethods.CallVoidMethod(JniObjectReference instance, JniMethodInfo method, JniArgumentValue* args)<8a19b22052394845b3d8400a8aa05cd1>:0 Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(string encodedMember, IJavaPeerable self, JniArgumentValue* parameters)<8a19b22052394845b3d8400a8aa05cd1>:0 Android.Views.View.set_Enabled(bool value)<72b4460d071c467fa3746c6821c025dd>:0 Xamarin.Forms.Platform.Android.ButtonRenderer.UpdateEnabled()<8783e2b68568446a8522c36407e66253>:0 Xamarin.Forms.Platform.Android.ButtonRenderer.OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)<8783e2b68568446a8522c36407e66253>:0 .invoke_void_object_PropertyChangedEventArgs(object, PropertyChangedEventArgs)(wrapper delegate-invoke) Xamarin.Forms.BindableObject.OnPropertyChanged(string propertyName)<6e20d7af277949f4a7bb952d64b81cda>:0 Xamarin.Forms.Element.OnPropertyChanged(string propertyName)<6e20d7af277949f4a7bb952d64b81cda>:0 Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindableObject.BindablePropertyContext context, object value, bool currentlyApplying, BindableObject.SetValueFlags attributes, bool silent)<6e20d7af277949f4a7bb952d64b81cda>:0 Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, object value, BindableObject.SetValueFlags attributes, BindableObject.SetValuePrivateFlags privateAttributes)<6e20d7af277949f4a7bb952d64b81cda>:0 Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, object value, BindableObject.SetValueFlags attributes)<6e20d7af277949f4a7bb952d64b81cda>:0 Xamarin.Forms.Button.set_IsEnabledCore(bool value)<6e20d7af277949f4a7bb952d64b81cda>:0 Xamarin.Forms.Button.CommandCanExecuteChanged(object sender, EventArgs eventArgs)<6e20d7af277949f4a7bb952d64b81cda>:0 .invoke_void_object_EventArgs(object, EventArgs)(wrapper delegate-invoke) Xamarin.Forms.Command.ChangeCanExecute()<6e20d7af277949f4a7bb952d64b81cda>:0 Musterd.UI.PageModels.SelectMusterPointPageModel.set_OkButtonEnabled(bool value):0

This is on a Samsung S7 running Android N.

The app is running Xamarin.Forms 2.3.4.270

It looks to be something rather deep in Xamarin.Forms under Android. Anyone seen this and/or got any suggestions?

1
Not exact exception but i get also crashes on 2.3.4. Especially Java stackoverflow exception is very annoying which didnt occur in 2.3.3 looks like xamarin has some Breaking changesEmil

1 Answers

0
votes

I found that we were invoking a Command's ChangeCanExecute method in response to an Event being handled, but we weren't on the UI thread.

Changing to run on the UI thread fixed the problem.