-
Notifications
You must be signed in to change notification settings - Fork 2.1k
在Handler队列里面执行引发的【java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState】 #863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
同样是从后台进入前台还出现另外一种问题: java.lang.NullPointerException: There is no Fragment in the FragmentManager, maybe you need to call loadRootFragment() first!
at me.yokeyword.fragmentation.TransactionDelegate$6.run(TransactionDelegate.java:158)
at me.yokeyword.fragmentation.queue.ActionQueue.handleAction(ActionQueue.java:53)
at me.yokeyword.fragmentation.queue.ActionQueue.enqueueAction(ActionQueue.java:45)
at me.yokeyword.fragmentation.queue.ActionQueue.access$000(ActionQueue.java:17)
at me.yokeyword.fragmentation.queue.ActionQueue.access$100(ActionQueue.java:17)
at me.yokeyword.fragmentation.queue.ActionQueue$1.run(ActionQueue.java:37)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5401)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:919)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:714) 现在的执行代码是这样的,麻烦大佬帮忙看看是否存在问题: public abstract class AbstractProxyActivity extends SupportActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initContainer(savedInstanceState);
}
/**
* 返回根Delegate
*
* @return
*/
public abstract AbstractViewPlusDelegate setRootDelegate();
private void initContainer(@Nullable Bundle savedInstanceState) {
final ContentFrameLayout container = new ContentFrameLayout(this);
container.setId(R.id.delegate_container);
setContentView(container);
if (savedInstanceState == null) {
// 初次加载主入口activity的时候设置根Delegate
loadRootFragment(R.id.delegate_container, setRootDelegate());
}
} |
@Jiiiiiin 找到了原因, support v27.1.1 检查StateLoss的机制变了 @Override
public boolean isStateSaved() {
return mStateSaved || mStopped; // 在27.1.1之前,只检查mStateSaved
} 在Fragmentation private static void hookStateSaved(FragmentManager fragmentManager, Runnable runnable) {
...
if (isStateSaved(fragmentManager)) {
fragmentManagerImpl.mStateSaved = false; // 在之前版本中hack了该参数,让其绕过检查
runnable.run();
fragmentManagerImpl.mStateSaved = true;
} else {
runnable.run();
}
} 暂时提供2个方案:
另外: 该异常只会出现在 |
v1.3.4兼容了该问题 |
@YoKeyword thx |
support 28.0.0 comes up again |
Uh oh!
There was an error while loading. Please reload this page.
我们使用bugtags收集到一个如下的崩溃日志,目前线上项目使用的lib版本是:
收集日志截图:

重现步骤:

感觉是应用从后台重新恢复到前台的时候爆出来的;
请问这种问题怎么解决呢?
而且这个异常没有被fragmention统一异常处理收集:
走的不是上面的渠道爆出来的
@williamwue
@YoKeyword
The text was updated successfully, but these errors were encountered: