smarteist / Android-Image-Slider

Android Auto Image Slider
Apache License 2.0
945 stars 291 forks source link

Crash on production / Firebase Crash Log #218

Open mayank250004 opened 2 years ago

mayank250004 commented 2 years ago

Multiple crash log , i found in my production

Logs are from firebase

------------------------------------------------------1st Crash-------------------------------------------------------------- PageIndicatorView.java line 100 com.smarteist.autoimageslider.IndicatorView.PageIndicatorView.onRestoreInstanceState

Fatal Exception: java.lang.IllegalArgumentException Wrong state class, expecting View State but received class com.smarteist.autoimageslider.SliderPager$SavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/0x5. Make sure other views do not use the same id. android.view.View.onRestoreInstanceState (View.java:18973) com.smarteist.autoimageslider.IndicatorView.PageIndicatorView.onRestoreInstanceState (PageIndicatorView.java:100) android.view.View.dispatchRestoreInstanceState (View.java:18945) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:942)

------------------------------------------------------2nd Crash-------------------------------------------------------------

Fatal Exception: java.lang.IllegalStateException The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 64800, found: 32400 Pager id: 1 Pager class: class com.smarteist.autoimageslider.SliderPager Problematic adapter: class com.smarteist.autoimageslider.InfiniteAdapter.InfinitePagerAdapter com.smarteist.autoimageslider.SliderPager.populate (SliderPager.java:1131) com.smarteist.autoimageslider.SliderPager.populate (SliderPager.java:1080) com.smarteist.autoimageslider.SliderPager.onMeasure (SliderPager.java:1629) android.view.View.measure (View.java:24726) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:980)

keskin commented 2 years ago

I am having the same issue. Any luck on solving this?

mayank250004 commented 2 years ago

Not Yet.

No reply from the repo owner.

Look Like We have to fix own :)

MohammadRezaei92 commented 2 years ago

Did anyone fix this issue?

AliBinkhani commented 2 years ago

After months of struggling with this problem, I finally understood the solution to the problem As Firebase Log says, this problem occurs because multiple views have the same id, but the problem is not the SliderViews themselves, but their Indicator! My fragment had 3 SliderViews and I solved the problem like this:

sliderView1.getPagerIndicator().setId(View.generateViewId());
sliderView2.getPagerIndicator().setId(View.generateViewId());
sliderView3.getPagerIndicator().setId(View.generateViewId());