-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalArgumentException: Synchronous ResponseHandler used in AsyncHttpClient
after upgrade from 1.4.4 to 1.4.5
#751
Comments
Hey @bajtos, as the error message says, it's quite simple. Either use AsyncHttpResponseHandler subclass in combination with AsyncHttpClient(), or do use AsyncHttpResponseHandler where implemented And from your ticket I either cannot understand, why would this issue not popup in unit tests. Is it possible they use somehow customized version of I'm trying to dig deeper in your code, what I can see:
|
Thanks for the reply. I suspect the problem is in the fact that we use
FWIW, you can run the test yourself if you have node.js installed on your machine - just run Some of our tests use our own TestContext based on Other tests are using the context provided by I am not familiar with Android SDK internals, thus I cannot judge whether there is a difference in the test context that would explain the behaviour described above. Thank you for suggestions on how to improve our code. Unfortunately I don't have bandwidth to address them right now, but I'll keep track of them in strongloop-community/loopback-sdk-android#56. We can close the issue now, I'll reopen it if the change from |
Great to hear that, good luck with fixing it. Would love to know, if you come up with problem on side of |
Also latest stable is 1.4.6, you can see the changes in here: https://github.com/loopj/android-async-http/blob/master/CHANGELOG.md |
The class name HttpClient suggests that we are using the sync variant, while in reality we are using AsyncHttpClient under the hood. See android-async-http/android-async-http#751
FWIW, our SDK is using AsyncHttpResponseHandler and AsyncHttpClient. However, we are subclassing AsyncHttpClient into a custom class that is called HttpClient, which I think caused some confusion. I have renamed the class to make the code easier to understand, see strongloop-community/loopback-sdk-android#70 |
Thank you for follow up |
I'm having a similar issue. See |
In my case, I was calling post method from background. |
Is it true that we shouldn't call post method from background thread? |
same with @PalakSDarji , I got this issue calling it from a non main thread on android. Calling it from main thread fixed it |
Hi, the change introduced in #507 seems to break our module depending on android-asycn-http, see strongloop-community/loopback-sdk-android#55.
This is how I create my handler (a simplified example):
And this is the code using the callback:
The code works correctly with
v1.4.4
but throws withv1.4.5
.Could you please advise whether this is a bug in android-async-http or a problem in my code?
The text was updated successfully, but these errors were encountered: