donkingliang / ConsecutiveScroller

ConsecutiveScrollerLayout是Android下支持多个滑动布局(RecyclerView、WebView、ScrollView等)和普通控件(TextView、ImageView、LinearLayou、自定义View等)持续连贯滑动的容器,它使所有的子View像一个整体一样连续顺畅滑动。并且支持布局吸顶功能。
Apache License 2.0
2.72k stars 355 forks source link

ConsecutiveViewpager #onMeasure()报错 ,Fragment already added #224

Closed PeanutZhang closed 3 years ago

PeanutZhang commented 3 years ago

遇到一个偶发问题,在友盟后台发现的错误比较多,没有复现, 布局是: smartrefresh+.ConsecutiveScrollerLayout+ consecViewPager -> .ConsecutiveScrollerLayout+ recyclerview+consecViewpager 大佬有空可以看看什么原因吗 Thread Name: 'main' Back traces starts. java.lang.IllegalStateException: Fragment already added: HomeFirstFragment{41652c7} (3ccc68c7-a402-4e23-85dc-21b8b8026c81 id=0x7f09038c tag=android:switcher:2131297164:0) at androidx.fragment.app.FragmentStore.addFragment(FragmentStore.java:91) at androidx.fragment.app.FragmentManager.addFragment(FragmentManager.java:1713) at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:415) at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2404) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2162) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1971) at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:311) at androidx.fragment.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:249) at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1244) at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092) at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622) at com.xiyo.rm.v2.home.home_first.ConsecutiveViewPager.onMeasure(ConsecutiveViewPager.java:58) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout.measureChildWithMargins(ConsecutiveScrollerLayout.java:339) at com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout.onMeasure(ConsecutiveScrollerLayout.java:300) at android.view.View.measure(View.java:25959) at com.scwang.smart.refresh.layout.SmartRefreshLayout.onMeasure(SmartRefreshLayout.java:593) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:25959) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25959) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7112) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:826) at android.view.View.measure(View.java:25959) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3905) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2620) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2887) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2340) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9057) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1044) at android.view.Choreographer.doCallbacks(Choreographer.java:867) at android.view.Choreographer.doFrame(Choreographer.java:794) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1029) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:264) at android.app.ActivityThread.main(ActivityThread.java:8243) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049) Back traces ends.

donkingliang commented 3 years ago

这种问题一般是没有处理好Fragment的添加、删除,或者要添加的Fragment发生异常等。你可以网上搜一下这种错误的信息,搜关键字ViewPager+Fragment already added

PeanutZhang commented 3 years ago

这种问题一般是没有处理好Fragment的添加、删除,或者要添加的Fragment发生异常等。你可以网上搜一下这种错误的信息,搜关键字ViewPager+Fragment already added

好的,我再检查检查