Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ArrayIndexOutOfBoundsException - Retrofit Call

I am trying to call a PUT method on my Retrofit instance:

Response<UpdateUserProfileResponse> response = App.getService().updateUserProfile(//A good 26 parameters).execute();

The parameters in the updateUserProfile() are a mixture of String, Boolean and one List<MyObject>. When I call this method, I get the following error:

Throwing new exception 'length=238; index=1366' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=238; index=1366
06-28 21:53:12.458 3928-6610/com.subby.development A/art: art/runtime/thread.cc:1329]   at retrofit2.Response

Update

I found the issue. There are two RealmList<BackgroundString> which are causing the issue. When I evaluate both RealmLists, I get:

Unable to evaluate the expression method threw 'java.lang.IllegalStateException' exception.

like image 539
Subby Avatar asked Jun 28 '16 21:06

Subby


3 Answers

For anyone else stumbling upon this question, the actual issue most likely is this: https://issuetracker.google.com/issues/37078190 i.e. Instant Run on Marshmallow/23 (and maybe even 24) has issues in the android runtime. Android 8/26+ have an official fix, but for most people disabling Instant Run should be sufficient.

also re:
https://github.com/square/retrofit/issues/1486
https://github.com/square/retrofit/issues/1506

like image 132
qix Avatar answered Jan 04 '23 19:01

qix


Throwing new exception 'length=1120; index=2310' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=1120; index=2310

It's working fine in Android Nougat and Oreo but i was facing the issue in Marshmallow.I just fixed it by turning off the "Instant run". Do it by going to File->Settings -> Build, Execution, Deployment -> Instant Run and disable the instant run option

like image 35
Abraham Mathew Avatar answered Jan 04 '23 19:01

Abraham Mathew


I am also facing same issue:

Disable Instant Run solves the problem.

Follow path below:

Setting ->Build,Execution,Development -> Instant Run

like image 39
Fateh Singh Saini Avatar answered Jan 04 '23 18:01

Fateh Singh Saini