savvisingh / DateRangePicker

Date Range Picker is a Calendar Picker View to show a Customized Date Range Picker with improved UI and functionality to add subtitles to the dates
Apache License 2.0
783 stars 161 forks source link

Illegal State Exception : Must have atleast one month to display. Did you forget to call init()? #53

Open krupalbhardiya opened 5 years ago

krupalbhardiya commented 5 years ago

Fatal Exception: java.lang.IllegalStateException: Must have at least one month to display. Did you forget to call init()? at com.savvi.rangedatepicker.CalendarPickerView.onMeasure(CalendarPickerView.java) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692) at android.widget.LinearLayout.measureVertical(LinearLayout.java:760) at android.widget.LinearLayout.onMeasure(LinearLayout.java:629) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at android.widget.FrameLayout.onMeasure(FrameLayout.java:465) at androidx.cardview.widget.CardView.onMeasure(CardView.java) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at androidx.coordinatorlayout.widget.CoordinatorLayout.releaseTempRect(CoordinatorLayout.java) at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at android.widget.FrameLayout.onMeasure(FrameLayout.java:465) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692) at android.widget.LinearLayout.measureVertical(LinearLayout.java:760) at android.widget.LinearLayout.onMeasure(LinearLayout.java:629) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at android.widget.FrameLayout.onMeasure(FrameLayout.java:465) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692) at android.widget.LinearLayout.measureVertical(LinearLayout.java:760) at android.widget.LinearLayout.onMeasure(LinearLayout.java:629) at android.view.View.measure(View.java:17938) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5760) at android.widget.FrameLayout.onMeasure(FrameLayout.java:465) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2791) at android.view.View.measure(View.java:17938) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2484) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1464) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1693) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1342) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6829) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:804) at android.view.Choreographer.doCallbacks(Choreographer.java:607) at android.view.Choreographer.doFrame(Choreographer.java:576) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:790) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:210) at android.app.ActivityThread.main(ActivityThread.java:5839) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

Crashes in some devices. Though this library is added in the project and working correctly without any problem in emulator and some of the devices available. But still there are crashes reported in some devices.

savvisingh commented 5 years ago

Sure will look into it, can you please share the device list

krupalbhardiya commented 5 years ago

@savvisingh ,

Here is the list of devices that reported this issue. Samsung Galaxy J6, J4, S8+,A9 (2018), C9 Pro, J2 Pro, C7 Pro, J7, Note 5, J7 Neo OnePlus 3(ONEPLUS A3003), OnePlus 5T Vivo V11 Pro(1804), Xiaomi Redmi 6, Redmi 5, Redmi 4 Pro, Oppo F1S (A1601), F5(CPH1723)

RiteshF7 commented 5 years ago

you are not calling init() in your onCreate and using this calendar in XML. This error occurs if this library fails to find init function for the calendar.

krupalbhardiya commented 5 years ago

I am calling init in oncreate() of my Activity. Library is working well in my development device and many other. But there are some instances I have found in my logs where I have seen this bug from crashlytics.

On Fri 2 Aug, 2019, 1:44 PM Ritesh Singh, notifications@github.com wrote:

you are not calling init() in your onCreate and using this calendar in XML. This error occurs if this library fails to find init function for the calendar.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/savvisingh/DateRangePicker/issues/53?email_source=notifications&email_token=ABOHSLMTQ5S4A24NX4JYC33QCPUGRA5CNFSM4HEGQEM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3NARPA#issuecomment-517605564, or mute the thread https://github.com/notifications/unsubscribe-auth/ABOHSLI34JQL7AT4LE7RR43QCPUGRANCNFSM4HEGQEMQ .

ilfat commented 5 years ago

Same issue in Xamarin native, Xiaomi mi5s

ashutosh-verma commented 4 years ago

any update on this? app is crashing in some devices.