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);
}
}
What's on line 46 of FindEventActivity? This doesn't appear to have anything to do with Retrofit.
@JakeWharton Line 46 is: eventFeedController.getSmashHoundApi().createStory("5695159920492544").enqueue(new Callback<CreateStoryResponse>() {
@JakeWharton Like I said in my original message, I really don't think it has to do with retrofit either...but this stack trace only appears when I instantiate my Call object. Ultimately, I feel like I am doing something wrong with the call object. But I'm just not seeing it...its unfortunate that the logcat is so unhelpful.
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.
I love the open source community...so helpful.
@letos What version did you change yours to? com.android.tools.build:gradle:2.0.0-alpha5 ?
I have same issue. After downgrade gradle version to alpha3 it fixed.
danmikita, 'com.android.tools.build:gradle:2.0.0-alpha3'
@letos @sergeyfitis You guys rock! Thank you! Is there a place to file an issue with alpha-5?
Is there a place to file an issue with alpha-5?
I don't know.
Is there a place to file an issue with alpha-5?
I don't know.
Same here.
I created a bug in the AOSP bug tracker. Thanks for your help! https://code.google.com/p/android/issues/detail?id=199105
Cool, thanks :+1:
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.
I'm seeing the same problem (crash on instantiating the Call object) using gradle:2.1.0. Disabling instant run makes it work again.
So looks like an interaction between Call and Instant run
I use gradle 2.1.0. The problem only appear on my marshmallow device. But when I use emulator, the problem doesn't appear
Try to disable Instant run.
I was having this same problem. I upgraded the gradle plugin to 2.2.0-alpha2 and it seems to have gone away.
The 2.2.x line of development might fix this. Not sure. I know alpha2 works for me in my situation.
https://bintray.com/android/android-tools/com.android.tools.build.gradle/
classpath 'com.android.tools.build:gradle:2.2.0-alpha2'
I'd recommend folks give that a try. And you can keep using instant run.
This is insane.
I was having this similar problem and thought that it was the Facebook Graph API error. For me, downgrading gradle version didn't solve the problem too.
I had to disable Instant Run and it magically solved now.
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] Throwing new exception 'length=127; index=1954' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=127; index=1954
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void co.base.activity.RegisterActivity.registerSeller(org.json.JSONObject) (RegisterActivity.java:193)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void co.base.activity.RegisterActivity.access$100(co.base.activity.RegisterActivity, org.json.JSONObject) (RegisterActivity.java:53)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void co.base.activity.RegisterActivity$2.onCompleted(org.json.JSONObject, com.facebook.GraphResponse) (RegisterActivity.java:142)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void com.facebook.GraphRequest$1.onCompleted(com.facebook.GraphResponse) (GraphRequest.java:304)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void com.facebook.GraphRequest$5.run() (GraphRequest.java:1368)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:739)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void android.os.Looper.loop() (Looper.java:148)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5417)
06-18 12:42:34.302 1920-1920/co.base.debug 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)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:726)
06-18 12:42:34.302 1920-1920/co.base.debug A/art: art/runtime/thread.cc:1344] at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:616)
Hi everyone, I have fixed this bug disabling "Instant Run", but: Is there any solution that doesn't means disable a good feature of Android Studio, or using a workarround?
It happens with MarshMallow devices. Could it be a permissions problem?
Thank for your comments, It was a huge help.
I found it working fine even with "Insta Run" when I use @Post annotation with @Field annotation instead of @Query .
I guess @Query should be used with @Get only.
@JakeWharton Please let me know if I am wrong about it.
Thanks,
Mehul.
Same error here ! Any solution yet ?
Disabling "Instant Run" works but it is increasing development time.
The same issue...
This is a build system problem, not a Retrofit problem. There is a bug filed in the appropriate place.
Most helpful comment
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.