retrofit: ART Runtime ArrayIndexOutOfBoundsException when instantiating Call object

This is a crazy error I am getting that I am having an incredibly difficult time debugging. I have determined that it is thrown when trying to instantiate the Call object itself, and not when calling enqueue.

This error also doesn’t occur on all of my Calls either, just on one in particular. This is what made me think it was something I was personally doing wrong, but I can’t find the problem, which leads me to believe there might just be a problem with Call? If I’m crazy let me know.

Thank you in advance!

The error:

01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344] Throwing new exception 'length=248; index=1273' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=248; index=1273
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void com.lifeisgreaterthan.checkblocks.activity.FindEventActivity.postStory() (FindEventActivity.java:46)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void com.lifeisgreaterthan.checkblocks.activity.FindEventActivity$$ViewBinder$1.doClick(android.view.View) (FindEventActivity$$ViewBinder.java:17)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void butterknife.internal.DebouncingOnClickListener.onClick(android.view.View) (DebouncingOnClickListener.java:22)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at boolean android.view.View.performClick() (View.java:5204)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void android.view.View$PerformClick.run() (View.java:21153)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:739)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void android.os.Looper.loop() (Looper.java:148)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5417)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:726)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:616)
01-17 21:52:18.466 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/thread.cc:1344] 
01-17 21:52:18.676 21705-21711/com.lifeisgreaterthan.checkblocks W/art: Suspending all threads took: 170.654ms
01-17 21:52:18.711 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
01-17 21:52:18.711 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/runtime.cc:366] Runtime aborting --- recursively, so no thread-specific detail!
01-17 21:52:18.711 21705-21705/com.lifeisgreaterthan.checkblocks A/art: art/runtime/runtime.cc:366] 
01-17 21:52:18.711 21705-21705/com.lifeisgreaterthan.checkblocks A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 21705 (han.checkblocks)

Retrofit API:

@POST("/_ah/api/story/v1/create")
    Call<CreateStoryResponse> createStory(@Query("event_id") String eventId);

Where I am calling it:

eventFeedController.getSmashHoundApi().createStory("5695159920492544").enqueue(new Callback<CreateStoryResponse>() {
            @Override
            public void onResponse(retrofit.Response<CreateStoryResponse> response, Retrofit retrofit) {
                RequestBody media;

                if (eventFeedController.getCurrentMediaFileType() == CameraHelper.MEDIA_TYPE_IMAGE) {
                    media = RequestBody.create(MediaType.parse("image/jpeg"), eventFeedController.getCurrentMediaFile());
                    uploadImage(response.body().getUploadUrl(), media);
                } else {
                    media = RequestBody.create(MediaType.parse("video/mp4"), eventFeedController.getCurrentMediaFile());
                    uploadVideo(response.body().getUploadUrl(), media);
                }
            }

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Seeing same issue that points to retrofit. Using alpha 3 did not help. Added comment onto the bug tracker.

We only see this issue when instant run in enabled. Disable instant run or build from command line and everything works fine.

I also removed the api call causing crash for funsies… No crash and all other calls work correctly even with instant run enabled.

Perplexed.

Same error here ! Any solution yet ? Disabling “Instant Run” works but it is increasing development time.

danmikita, 'com.android.tools.build:gradle:2.0.0-alpha3'

Perhaps it will help. I had the same error and fixed it by switching gradle plugin version from ‘2.0.0-alpha5’ to lower. So take look at your project configuration.