简体   繁体   English

使用 Retrofit 调用获取 Web 服务请求时。 “android.os.TransactionTooLargeException:数据包大小 1575704 字节”

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

This is my code.这是我的代码。 I am simply calling get a request for my profile through the activity.我只是通过活动调用获取我的个人资料的请求。 And I got this error for that.我因此得到了这个错误。 when I comment the method call (Get Request method) it works fine and shows me my UI.当我评论方法调用(Get Request 方法)时,它工作正常并向我显示我的 UI。 but when calling it just showing a black screen with this recursive following response.但是当调用它时,它只显示一个带有这个递归跟随响应的黑屏。

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

Please help stuck here...请帮助卡在这里...

//Error //错误

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)

//Activity //活动

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

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

//method //方法

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 //request_Call_from_interface

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

I was having the same issue.我遇到了同样的问题。 After many many many tests, I finally found the cause: my model (the one used in method response, in your case AdminProfileRequest ) was implementing Parcelable which internally I needed in other instances of my app.经过很多很多很多的测试,我终于找到了原因:我的模型(在方法响应中使用的一个,你的情况AdminProfileRequest )正在实施Parcelable在内部,我需要在我的应用程序的其他实例。 Removing that implementation (and implementing a work-around for passing data between activities/fragments) fixed the crash.删除该实现(并实现在活动/片段之间传递数据的变通方法)修复了崩溃。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android.os.TransactionTooLargeException:数据包大小565156字节 - android.os.TransactionTooLargeException: data parcel size 565156 bytes 由于java.lang.RuntimeException而在图库中崩溃:android.os.TransactionTooLargeException:数据包大小539544字节 - Crash in gallery due to java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 539544 bytes android.os.TransactionTooLargeException:数据包大小NOUGAT错误 - android.os.TransactionTooLargeException: data parcel size NOUGAT ERROR java.lang.RuntimeException:android.os.TransactionTooLargeException:在片段之间导航时数据包大小558780字节 - java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 558780 bytes when navigating between fragment 启动活动 android.os.TransactionTooLargeException 时出现异常:数据包大小 - Exception when starting activity android.os.TransactionTooLargeException: data parcel size 启动器中的android.os.transactiontoolargeexception - android.os.transactiontoolargeexception in Launcher android.os.TransactionTooLargeException的牛轧糖 - android.os.TransactionTooLargeException on Nougat 使用巨型recycleview时出现android.os.TransactionTooLargeException - android.os.TransactionTooLargeException when using giant recycleview Android中的android.os.TransactionTooLargeException错误 - android.os.TransactionTooLargeException error in Android 如何避免得到“android.os.TransactionTooLargeException” - how to avoid getting the “android.os.TransactionTooLargeException”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM