Firstly, What I tried to resolve the issue below:
Step 1. I have put a method in my BaseActivity and BaseActivity abstract class, to know when the Activity is stopped and when view (root view of fragment) is destroyed [returns true in both the cases, but false before the event (onStop(), onViewDestroyed()) is called].
Step 2. I have prevented the one and only SnackBar to be shown when the true is returned in any of the both. Also checked isFinishing() of the BaseActivity.
But the error does not go away.
I want to know more about this class:
android.support.design.widget.BaseTransientBottomBar
and the internal exception related to it, and how to resolve the following:
08-25 16:45:50.826 5618-5688/com.my_package D/CrashlyticsCore: Session 5B8139230285-0001-15F2-C62ED7C4B2D1 has fatal exception: true
08-25 16:45:50.827 5618-5688/com.my_package D/CrashlyticsCore: Session 5B8139230285-0001-15F2-C62ED7C4B2D1 has non-fatal exceptions: false
08-25 16:45:51.481 5618-5618/com.my_package E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.my_package, PID: 5618
java.lang.IllegalStateException: ScrollView can host only one direct child
at android.widget.ScrollView.addView(ScrollView.java:251)
at android.support.design.widget.BaseTransientBottomBar.showView(BaseTransientBottomBar.java:428)
at android.support.design.widget.BaseTransientBottomBar$1.handleMessage(BaseTransientBottomBar.java:176)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
08-25 16:45:53.654 5618-5688/com.my_package D/CrashlyticsCore: Removing report at /data/user/0/com.my_package/files/.Fabric/com.crashlytics.sdk.android.crashlytics-core/fatal-sessions/5B8139230285-0001-15F2-C62ED7C4B2D1.cls
08-25 16:45:58.626 9576-9643/com.my_package D/CrashlyticsCore: Session 5B813A670174-0002-15F2-C62ED7C4B2D1 has fatal exception: false
08-25 16:45:58.627 9576-9643/com.my_package D/CrashlyticsCore: Session 5B813A670174-0002-15F2-C62ED7C4B2D1 has non-fatal exceptions: false
No events present for session ID 5B813A670174-0002-15F2-C62ED7C4B2D1
Removing session part files for ID 5B813A670174-0002-15F2-C62ED7C4B2D1
Details:
Please note that mine is Desire 816 HTC device, it started from KitKat, and is now upgraded to MarshMallow, but still has the bugs of KitKat, like Camera not releasing resources and crashing, subsequently, after taking first picture.
But there must be some solution to prevent this, like the following solution:
https://stackoverflow.com/a/52014209/787399
My best regards.