繁体   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