1. 程式人生 > >android.os.TransactionTooLargeException: data parcel size xxxx bytes

android.os.TransactionTooLargeException: data parcel size xxxx bytes

針對這個問題也百度看了一下, 發現其實很多人都遇到過這個問題




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. 根據程式碼定位問題