簡體   English   中英

使用 Retrofit 調用獲取 Web 服務請求時。 “android.os.TransactionTooLargeException:數據包大小 1575704 字節”

[英]while calling get web service request Using Retrofit. “android.os.TransactionTooLargeException: data parcel size 1575704 bytes”

這是我的代碼。 我只是通過活動調用獲取我的個人資料的請求。 我因此得到了這個錯誤。 當我評論方法調用(Get Request 方法)時,它工作正常並向我顯示我的 UI。 但是當調用它時,它只顯示一個帶有這個遞歸跟隨響應的黑屏。

I/art: Background sticky concurrent mark sweep GC freed 8216(299KB) AllocSpace objects, 0(0B) LOS objects, 14% free, 93MB/109MB, paused 5.381ms total 19.009ms

請幫助卡在這里...

//錯誤

E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1575704)
E/AndroidRuntime: Error reporting crash
              android.os.TransactionTooLargeException: data parcel size 1575704 bytes
                  at android.os.BinderProxy.transactNative(Native Method)
                  at android.os.BinderProxy.transact(Binder.java:503)
                  at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:4480)
                  at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:90)
                  at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
                  at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

//活動

  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.admin_profile_activity);
    mAPIService = ApiUtils.getAPIService();

   //method call
   requestProfileDetail(LoginActivity.authTOken);
   
}

//方法

private void requestProfileDetails(String authoken){
    mAPIService.getProfileDetails(authoken).enqueue(new 
      Callback<AdminProfileRequest>() {
        @Override
        public void onResponse(Call<AdminProfileRequest> call,Response<AdminProfileRequest> response) {
            if(response.isSuccessful()) {
                Log.d("Name","Name ");

            }else{
                Log.d("response", "code = " + response.code());
                Log.d("response: ","boyd= "+response.body());
                APIError error = ErrorUtils.parseError(response);

                Log.d("error message", ""+error.message());
            }
        }

        @Override
        public void onFailure(Call<AdminProfileRequest> call, Throwable t) {

        }
    });
}

//request_Call_from_interface

@GET("getuserprofile")
Call<AdminProfileRequest> getDetails(@Header("Authorization") String 
authToken);

我遇到了同樣的問題。 經過很多很多很多的測試,我終於找到了原因:我的模型(在方法響應中使用的一個,你的情況AdminProfileRequest )正在實施Parcelable在內部,我需要在我的應用程序的其他實例。 刪除該實現(並實現在活動/片段之間傳遞數據的變通方法)修復了崩潰。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM