wdullaer / MaterialDateTimePicker

Pick a date or time on Android in style
Apache License 2.0
4.67k stars 949 forks source link

Crash on Android 7 when using DatePickerDialog #708

Open sunnykinger opened 3 years ago

sunnykinger commented 3 years ago

Whenever the show function is called, the application is crashing on Android 7, In Android 10 & 11 it is working fine.

android.view.InflateException: Binary XML file line #29: Binary XML file line #17: Error inflating class TextView Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class TextView Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1} at android.content.res.TypedArray.getColorStateList(TypedArray.java:528) at android.widget.TextView.(TextView.java:783) at android.widget.TextView.(TextView.java:704) at androidx.appcompat.widget.AppCompatTextView.(AppCompatTextView.java:100) at com.google.android.material.textview.MaterialTextView.(MaterialTextView.java:93) at com.google.android.material.textview.MaterialTextView.(MaterialTextView.java:88) at com.google.android.material.textview.MaterialTextView.(MaterialTextView.java:83) at com.google.android.material.theme.MaterialComponentsViewInflater.createTextView(MaterialComponentsViewInflater.java:61) at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:115) at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1551) at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1602) at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:964) at android.view.LayoutInflater.rInflate(LayoutInflater.java:854) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.inflate(LayoutInflater.java:518) at android.view.LayoutInflater.inflate(LayoutInflater.java:426) at com.wdullaer.materialdatetimepicker.date.DatePickerDialog.onCreateView(DatePickerDialog.java:368) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2699) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:320) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1199) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1368) at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1446) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1509) at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447) at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2181) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2004) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1959) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1861) at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

UPDATE It's working fine overall, but the place where it crashes is inside fragments

I have a registration process which has 4 pages so using fragment transaction I move from page 1 to page 4. In the final page, I have a button which should show this DatePickerDialog, there is crashes. If this dialog is used in the first page, then it works fine. It is something to do with fragment transaction