测试部挂monkey,跑出个这么个崩溃日志,分析来分析去也没分析出什么问题。
从搜索来看,还是有人遇到这个问题。
记录下。
http://zhiweiofli.iteye.com/blog/1539467
关于onSaveInstance方法和commit方法之间的关系,在FragmentManager.java (./framework/base/core/java/android/app/FragmentManager.java)
/**
* Start a series of edit operations on the Fragments associated with
* this FragmentManager.
*
* <p>Note: A fragment transaction can only be created/committed prior
* to an activity saving its state. If you try to commit a transaction
* after {@link Activity#onSaveInstanceState Activity.onSaveInstanceState()}
* (and prior to a following {@link Activity#onStart Activity.onStart}
* or {@link Activity#onResume Activity.onResume()}, you will get an error.
* This is because the framework takes care of saving your current fragments
* in the state, and if changes are made after the state is saved then they
* will be lost.</p>
*/
public abstract FragmentTransaction beginTransaction();
从上面可以看出,transaction的创建以及commit必须比activity的save要早。
从
private void checkStateLoss() {
if (mStateSaved) {
throw new IllegalStateException(
"Can not perform this action after onSaveInstanceState");
}
if (mNoTransactionsBecause != null) {
throw new IllegalStateException(
"Can not perform this action inside of " + mNoTransactionsBecause);
}
}
分析log,量的时候比较轻松,量多了,整个十几个压缩包,真是一件痛苦的事。
因此,分析log掌握方法很有必要。比如查找对应的导致FC的进程id,然后根据这个id 顺藤摸瓜,或者根据事件code,比如keyCode = 4 是返回键,此时,
adb等工具命令排上用场。