欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

android.os.TransactionTooLargeException: data parcel size xxxx bytes

程序员文章站 2022-04-15 17:44:53
...
针对这个问题也百度看了一下, 发现其实很多人都遇到过这个问题




1. 界面跳转   intent 中的数据内容较多   android.os.TransactionTooLargeException    




2. Android调用系统裁减图片,出现android.os.TransactionTooLargeException: data parcel size 642356 bytes




3. insert to db    (我是在插入联系人数据库的时候报错的)  resolver.applypatch() ---- 最后修改数据量变小




7.0 源码位置:



android/frameworks/base/core/jni/android_util_Binder.cpp






case FAILED_TRANSACTION: {
684            ALOGE("!!! FAILED BINDER TRANSACTION !!!  (parcel size = %d)", parcelSize);
685            const char* exceptionToThrow;
686            char msg[128];
687            // TransactionTooLargeException is a checked exception, only throw from certain methods.
688            // FIXME: Transaction too large is the most common reason for FAILED_TRANSACTION
689            //        but it is not the only one.  The Binder driver can return BR_FAILED_REPLY
690            //        for other reasons also, such as if the transaction is malformed or
691            //        refers to an FD that has been closed.  We should change the driver
692            //        to enable us to distinguish these cases in the future.
693            if (canThrowRemoteException && parcelSize > 200*1024) {    --------- 在这里是有判断的  
694                // bona fide large payload
695                exceptionToThrow = "android/os/TransactionTooLargeException";
696                snprintf(msg, sizeof(msg)-1, "data parcel size %d bytes", parcelSize);
697            } else {
698                // Heuristic: a payload smaller than this threshold "shouldn't" be too
699                // big, so it's probably some other, more subtle problem.  In practice
700                // it seems to always mean that the remote process died while the binder
701                // transaction was already in flight.
702                exceptionToThrow = (canThrowRemoteException)
703                        ? "android/os/DeadObjectException"
704                        : "java/lang/RuntimeException";
705                snprintf(msg, sizeof(msg)-1,
706                        "Transaction failed on small parcel; remote process probably died");
707            }
708            jniThrowException(env, exceptionToThrow, msg);
709        } break;


今天又看到了另外一个文章,

http://blog.csdn.net/guoqifa29/article/details/47839913


1. 查看log 定位 pid 和 出错原因


2. 查看Kernel log 根据 pid


3. 定位报错代码


4. 根据代码定位问题