java.lang.IllegalStateException:已添加

时间:2019-06-02 07:51:49

标签: java android crash oncreate

最近我的应用程序遇到了以下崩溃:

[(6, 2), (5, 3), (4, 3)]

我已经搜索了这个问题,但是到目前为止还没有找到任何解决方案。 它说“已经添加!”,但我不知道这意味着什么...

edit:这可能与先前添加的片段有关。我正在使用PagerAdapter,这是与片段相关的代码:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx/com.xxx.MapsActivity}: java.lang.IllegalStateException: Already added!
           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3108)
           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3251)
           at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
           at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
           at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
           at android.os.Handler.dispatchMessage(Handler.java:106)
           at android.os.Looper.loop(Looper.java:214)
           at android.app.ActivityThread.main(ActivityThread.java:7045)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Caused by java.lang.IllegalStateException: Already added!
       at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:3148)
       at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:158)
       at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:344)
       at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:85)
       at com.xxx.MapsActivity.onCreate(MapsActivity.java:15) - where it crashes in MY code
       at android.app.Activity.performCreate(Activity.java:7327)
       at android.app.Activity.performCreate(Activity.java:7318)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3088)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3251)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7045)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

0 个答案:

没有答案