Closed fotospiro closed 3 years ago
My application has crashed when I selected a range in April, then changed the range to (from April 5 to May 31), and then entered the calendar again and only then app crashed. Now crash amount increased, May month ended, and users began to choose such a date range. This crash has a huge impact on the business, as users are unable to select specific dates. Please fix it as soon as possible. Also here is a similar bug https://github.com/material-components/material-components-android/issues/2158
Thanks for reporting the issue.
A fix has been made and should be able to be submitted early next week.
Fixed.
It still crashes with com.google.android.material:material:1.4.0 (Emulator with Android 8)
Here build.gradle (:app)
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api 'joda-time:joda-time:2.9.9'
}
And log
2021-07-05 09:11:33.106 6996-6996/com.example.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 6996
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference
at com.google.android.material.datepicker.MaterialCalendarGridView.horizontalMidPoint(MaterialCalendarGridView.java:242)
at com.google.android.material.datepicker.MaterialCalendarGridView.onDraw(MaterialCalendarGridView.java:172)
at android.view.View.draw(View.java:19123)
at android.widget.AbsListView.draw(AbsListView.java:4317)
at android.view.View.updateDisplayListIfDirty(View.java:18073)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at androidx.recyclerview.widget.RecyclerView.drawChild(RecyclerView.java:5030)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.draw(View.java:19126)
at androidx.recyclerview.widget.RecyclerView.draw(RecyclerView.java:4429)
at android.view.View.updateDisplayListIfDirty(View.java:18073)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.draw(View.java:19126)
at com.android.internal.policy.DecorView.draw(DecorView.java:785)
at android.view.View.updateDisplayListIfDirty(View.java:18073)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:643)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:649)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:757)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2980)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2794)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2347)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
2021-07-05 09:11:33.106 6996-6996/com.example.myapplication E/AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Select a date-range across two months. Open MaterialCalendarGridView on current month (april 2021 with 5 weeks) and select a day, move to next month (may with 6 weeks) and select the last day (it's invisible!). When select the last day, it crashes.
MainActivity.java
The problem is with
builder.setTheme(R.style.ThemeOverlay_HRAppTheme_MaterialCalendar);
style.xml
activity_main.xml
Android API version: Android API 26
Material Library version: com.google.android.material:material:1.3.0 com.google.android.material:material:1.4.0-alpha02 com.google.android.material:material:1.4.0-beta01 com.google.android.material:material:1.4.0-rc01 com.google.android.material:material:1.4.0
Device: Emulator
Here the stacktrace
2021-04-29 16:57:30.483 19374-19374/com.zucchetti.hr.hrsuite E/AndroidRuntime: FATAL EXCEPTION: main Process: com.zucchetti.hr.hrsuite, PID: 19374 java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference at com.google.android.material.datepicker.MaterialCalendarGridView.horizontalMidPoint(MaterialCalendarGridView.java:242) at com.google.android.material.datepicker.MaterialCalendarGridView.onDraw(MaterialCalendarGridView.java:172) at android.view.View.draw(View.java:19123) at android.widget.AbsListView.draw(AbsListView.java:4317) at android.view.View.updateDisplayListIfDirty(View.java:18073) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at androidx.recyclerview.widget.RecyclerView.drawChild(RecyclerView.java:5030) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.draw(View.java:19126) at androidx.recyclerview.widget.RecyclerView.draw(RecyclerView.java:4429) at android.view.View.updateDisplayListIfDirty(View.java:18073) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.updateDisplayListIfDirty(View.java:18064) at android.view.View.draw(View.java:18851) at android.view.ViewGroup.drawChild(ViewGroup.java:4214) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000) at android.view.View.draw(View.java:19126) at com.android.internal.policy.DecorView.draw(DecorView.java:785) at android.view.View.updateDisplayListIfDirty(View.java:18073) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:643) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:649) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:757) at android.view.ViewRootImpl.draw(ViewRootImpl.java:2980) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2794) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2347) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733) 2021-04-29 16:57:30.483 19374-19374/com.zucchetti.hr.hrsuite E/AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)