Crash Java.Lang.IllegalStateException: HorizontalScrollView can host only one direct child

05-05 09:18:07.551 I/MonoDroid( 3236): UNHANDLED EXCEPTION:
05-05 09:18:07.566 I/MonoDroid( 3236): Java.Lang.IllegalStateException: HorizontalScrollView can host only one direct child
05-05 09:18:07.566 I/MonoDroid( 3236):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0008e] in <064cde681fba4dd08eaf8b1bdbbfb8c8>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <064cde681fba4dd08eaf8b1bdbbfb8c8>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Android.Views.ViewGroup.AddView (Android.Views.View child) [0x00031] in <4a189ea3b82b48a089ac9002b2abc206>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.Droid.PageScrollView.AddPage (Syncfusion.SfPdfViewer.XForms.Droid.ImageAndCanvasContainer page) [0x00000] in <337aca1f13af413a942bf167885df84d>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.Droid.PageScrollViewContainer.AddViewToScrollView (Syncfusion.SfPdfViewer.XForms.Droid.ImageAndCanvasContainer page, System.Int32 index) [0x00017] in <337aca1f13af413a942bf167885df84d>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.Droid.SinglePageViewer.AddBlankPage (System.Boolean left) [0x0013a] in <337aca1f13af413a942bf167885df84d>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.Droid.SinglePageViewer.Initialize () [0x00059] in <337aca1f13af413a942bf167885df84d>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.Droid.SfPdfViewerEx.SetViewMode (Syncfusion.SfPdfViewer.XForms.PageViewMode viewMode) [0x0006a] in <337aca1f13af413a942bf167885df84d>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.Droid.PdfDependencyServices.SetViewMode (System.Object nativeObject, Syncfusion.SfPdfViewer.XForms.PageViewMode viewMode) [0x00003] in <337aca1f13af413a942bf167885df84d>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.SfPdfViewer.OnPageViewModeChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00037] in <99c28d76cb574eafadf8f5569a98e0f6>:0 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334 
05-05 09:18:07.566 I/MonoDroid( 3236):   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311 
05-05 09:18:07.567 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.SfPdfViewer.set_PageViewMode (Syncfusion.SfPdfViewer.XForms.PageViewMode value) [0x00000] in <99c28d76cb574eafadf8f5569a98e0f6>:0 
05-05 09:18:07.567 I/MonoDroid( 3236):   at Syncfusion.SfPdfViewer.XForms.ViewModeOptionsToolbar.singlePage_Tapped (System.Object sender, System.EventArgs e) [0x00000] in <99c28d76cb574eafadf8f5569a98e0f6>:0 
05-05 09:18:07.567 I/MonoDroid( 3236):   at Xamarin.Forms.TapGestureRecognizer.SendTapped (Xamarin.Forms.View sender) [0x0002e] in D:\a\1\s\Xamarin.Forms.Core\TapGestureRecognizer.cs:48 
05-05 09:18:07.567 I/MonoDroid( 3236):   at Xamarin.Forms.Platform.Android.TapGestureHandler.OnTap (System.Int32 count, Xamarin.Forms.Point point) [0x000a2] in D:\a\1\s\Xamarin.Forms.Platform.Android\TapGestureHandler.cs:52 
05-05 09:18:07.567 I/MonoDroid( 3236):   at Xamarin.Forms.Platform.Android.InnerGestureListener.Android.Views.GestureDetector.IOnGestureListener.OnSingleTapUp (Android.Views.MotionEvent e) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.Android\InnerGestureListener.cs:151 
05-05 09:18:07.567 I/MonoDroid( 3236):   at Android.Views.GestureDetector+IOnGestureListenerInvoker.n_OnSingleTapUp_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x00011] in <4a189ea3b82b48a089ac9002b2abc206>:0 
05-05 09:18:07.567 I/MonoDroid( 3236):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.138(intptr,intptr,intptr)
05-05 09:18:07.567 I/MonoDroid( 3236):   --- End of managed Java.Lang.IllegalStateException stack trace ---
05-05 09:18:07.567 I/MonoDroid( 3236): java.lang.IllegalStateException: HorizontalScrollView can host only one direct child

5 Replies

AV Ashokkumar Viswanathan Syncfusion Team May 6, 2020 11:31 AM UTC

Hi Sergiu, 
 
We were unable to reproduce the issue, “Application crashes with Java.Lang.IllegalStateException while switching from continuous page to single page view mode” in Android Platform with the provided information. Please find the sample in the below link, which we have created to reproduce the issue. 
 
  
Kindly share the following details to analyze more on this issue and assist you with the better solution       
  1. Simple sample/ modify the above sample to reproduce the issue. 
  2. PDF document with which you have to reproduce the issue.
  3. Replication procedure/Video to reproduce the issue.
  4. Xamarin Forms version.
  5. SfPdfViewer version.
  6. Deployment device specification.
Regards, 
Ashok Kumar Viswanathan. 



HA Hasitha June 1, 2020 08:54 AM UTC

I was facing this exact same issue when using SfPdfViewer.Xamarin.Android. The cause of this issue is that if the SfPdfViewer control lose the focus while it is trying to change the page view mode (i.e. to the page number entry EditText) you get a Java.Lang.IllegalStateException thrown. To fix this you can set the focus back to the SfPdfViewer control before you are changing the page view mode by calling pdfViewer.RequestFocus();.

However, I believe this bug needs to be fixed within the library as there are no events to subscribe to before changing the page view mode to call RequestFocus() when using the default toolbar.




    AV Ashokkumar Viswanathan Syncfusion Team June 2, 2020 07:28 AM UTC

    Hi Seirgu, 
     
    We were able to reproduce the issue, “Application crashes with Java.Lang.IllegalStateException while switching from continuous page to single page view mode when Page number entry on focus” in Android Platform. Currently, we are validating the issue and we will update the further details on June 4th, 2020. 
     
    Regards, 
    Ashok Kumar Viswanathan. 



    AV Ashokkumar Viswanathan Syncfusion Team June 4, 2020 04:27 PM UTC

    Hi Seirgu, 
     
    We have confirmed that the issue, Application crashes with Java.Lang.IllegalStateException while switching from continuous page to single page view mode when Page number entry on focus” in Android Platform is s defect and logged defect report for the issue. We will provide patch for the issue on June 18th , 2020. 
     
    Please find the feedback link below:   
     
    Regards, 
    Ashok Kumar Viswanathan. 



    AV Ashokkumar Viswanathan Syncfusion Team June 18, 2020 03:44 PM UTC

    Hi Seirgu, 
     
    Thank you for your patience, 
     
    We have resolved the issue, “Application crashes with Java.Lang.IllegalStateException while switching from continuous page to single page view mode when Page number entry on focus” in Android Platform and patch for the issue can be downloaded from the following location.    
      
    Please find the feedback link below,  
     
    Recommended approach - exe will perform automatic configuration 
    Please find the patch setup from below location:  
      
    Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment 
    Please find the patch assemblies alone from below location:
      
         
         
    NuGet:  
     
    Assembly Version: 18.1.0.42
     

    Installation Directions :  
    This patch should replace the files “Syncfusion.SfPdfViewer.Android.dll” under the following folder. $system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.6 Eg : $system drive:\Program Files\Syncfusion\Essential Studio\9.3.0.61\precompiledassemblies\9.3.0.61\4.0 
     
    To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies. 
     
     
    Note : Kindly follow the steps to clear the NuGet cache and then install patched NuGet to get the issue resolved.   
       
     
    Disclaimer :  
    Please note that we have created this patch for version 18.1.0.42 specifically to resolve the following issue(s) reported in this/the Forum(s). 153949
     
    If you have received other patches for the same version for other products, please apply all patches in the order received. 
    This fix will be included in our 2020 Volume 2 Main Release which will be available in June 2020.  
     
      
    Regards,  
    Ashok Kumar Viswanathan  


    Loader.
    Up arrow icon