Android开发中在部分手机上出现一个极其诡异的问题:
android.os.TransactionTooLargeException: data parcel size 1069576 bytes
file:PendingTransactionActions.java class:android.app.servertransaction.PendingTransactionActions$StopInfo method:run line:161
file:Handler.java class:android.os.Handler method:handleCallback line:938
file:Handler.java class:android.os.Handler method:dispatchMessage line:99
file:Looper.java class:android.os.Looper method:loop line:223
file:ActivityThread.java class:android.app.ActivityThread method:main line:7664
file:Method.java class:java.lang.reflect.Method method:invoke line:-2
file:RuntimeInit.java class:com.android.internal.os.RuntimeInit$MethodAndArgsCaller method:run line:592
file:ZygoteInit.java class:com.android.internal.os.ZygoteInit method:main line:947
根据字面意思传输的序列化数据超过一定长度,但实际查找中却未发现哪里传输数据量过大。根据度娘查找的解决办法均无法解决问题,最后无意中找到一个帖子,真正给出了解决办法:
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.clear()
}