Android 代码闪退:
根本原因:嵌套使用Fragment造成了,即在Activity里使用了多个Fragment,其中有若干个Fragment里又嵌套了多个Fragment
解决方法:
https://blog.csdn.net/wangzhezhilu001/article/details/120726847
https://blog.csdn.net/qq_34081612/article/details/140461659
2024-07-24 14:29:25.192 11716 AndroidRuntime D Shutting down VM
2024-07-24 14:29:25.193 11716 AndroidRuntime E FATAL EXCEPTION: main
Process: com.vatilon.wananpro, PID: 11716
java.lang.IllegalStateException: FragmentManager is already executing transactions
at androidx.fragment.app.FragmentManager.ensureExecReady(FragmentManager.java:1695)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1754)
at androidx.fragment.app.FragmentManager.executePendingTransactions(FragmentManager.java:623)
at com.htl.app.module.album.adapter.PagerFragmentAdapter.switchFragmentControl(PagerFragmentAdapter.java:91)
at com.htl.app.module.album.adapter.PagerFragmentAdapter$MyOnPageChangeListener.onPageSelected(PagerFragmentAdapter.java:135)
at androidx.viewpager.widget.ViewPager.dispatchOnPageSelected(ViewPager.java:1941)
at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:665)
at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
at androidx.viewpager.widget.ViewPager.onRestoreInstanceState(ViewPager.java:1462)
at android.view.View.dispatchRestoreInstanceState(View.java:21438)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:4071)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:4077)
at android.view.View.restoreHierarchyState(View.java:21416)
at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:689)
at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:3151)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:3142)
at androidx.fragment.app.FragmentStateManager.activityCreated(FragmentStateManager.java:579)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:264)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1433)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2977)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2895)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:263)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:351)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:251)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1467)
at android.app.Activity.performStart(Activity.java:8224)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3810)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:65)
at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5889)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2337)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8285)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1074)