prolificinteractive / material-calendarview

A Material design back port of Android's CalendarView
https://prolificinteractive.github.io/material-calendarview/
MIT License
5.92k stars 1.32k forks source link

InflateException crash #938

Open huy1235 opened 5 years ago

huy1235 commented 5 years ago

I was on 1.6.1 and it was working fine until I updated to 2.0.0 or 2.0.1, then it just crashes instantly when the activity launches. Not sure what is the issue here.

2019-03-12 15:04:28.998 28108-28108/je.fit E/AndroidRuntime: FATAL EXCEPTION: main Process: je.fit, PID: 28108 android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class com.prolificinteractive.materialcalendarview.MaterialCalendarView Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.prolificinteractive.materialcalendarview.MaterialCalendarView Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at je.fit.calendar.ProgressFragment.onCreateView(ProgressFragment.java:162) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366) at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243) at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654) at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:168) at android.support.v4.view.ViewPager.populate(ViewPager.java:1244) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:669) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:631) at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:612) at je.fit.util.SlidingTabLayout$TabClickListener.onClick(SlidingTabLayout.java:320) at android.view.View.performClick(View.java:6294) at android.view.View$PerformClick.run(View.java:24770) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.NoSuchFieldError: No static field header of type I in class Lcom/prolificinteractive/materialcalendarview/R$id; or its superclasses (declaration of 'com.prolificinteractive.materialcalendarview.R$id' appears in /data/app/je.fit-aGaQPh_e2uxk0wcdMxoJ_w==/split_lib_slice_0_apk.apk!classes2.dex) at com.prolificinteractive.materialcalendarview.MaterialCalendarView.(MaterialCalendarView.java:266) at java.lang.reflect.Constructor.newInstance0(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:334)  at android.view.LayoutInflater.createView(LayoutInflater.java:647)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at je.fit.calendar.ProgressFragment.onCreateView(ProgressFragment.java:162)  at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)  at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)  at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)  at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)  at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)  at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)  at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243)  at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)  at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:168)  at android.support.v4.view.ViewPager.populate(ViewPager.java:1244)  at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:669)  at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:631)  at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:612)  at je.fit.util.SlidingTabLayout$TabClickListener.onClick(SlidingTabLayout.java:320)  at android.view.View.performClick(View.java:6294)  at android.view.View$PerformClick.run(View.java:24770)  at android.os.Handler.handleCallback(Handler.java:790)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6494)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

BlackBlind567 commented 5 years ago

First, what do you want to do ? Second, According to you logcat you have an error on your xml in 26 line. Third can you share your code with your need.

dryerflyer commented 5 years ago

I'm having the identical issue. As for line #26 I'm sure it is the same as mine:

    <com.prolificinteractive.materialcalendarview.MaterialCalendarView
      android:id="@+id/calendar_view"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:mcv_tileHeight="35dp"
      app:mcv_dateTextAppearance="@style/CalendarTextAppearance"/>
Caused by: java.lang.NoSuchFieldError: No static field previous of type I in class Lcom/prolificinteractive/materialcalendarview/R$id; or its superclasses (declaration of 'com.prolificinteractive.materialcalendarview.R$id' appears in /data/app/com.fitshare-cPnO6OncPAfp9gla-Kn-pg==/split_lib_slice_4_apk.apk)
        at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:267)
            ... 38 more

In MaterialCalendarView.java:

    topbar = content.findViewById(R.id.header);
    buttonPast = content.findViewById(R.id.previous);
    title = content.findViewById(R.id.month_name);

it's getting hung up on buttonPast