Closed newaz closed 7 years ago
I filled an issue in the android-async-http repository: https://github.com/loopj/android-async-http/issues/751
I don't understand one thing: how is it possible that our unit-tests do not experience this problem too?
have you tried like this ? They are saying to use AsyncHttp...
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://www.google.com", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
System.out.println(response);
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable
error)
{
error.printStackTrace(System.out);
}
});
@newaz could you please try the change yourself and submit it as a pull request if it fixes the problem for you?
Sorry I could not work on it later. So it seems you hvae found out the cause form the loopj discussion, right?
Well, I assume that replacing HttpClient
with AsyncHttpClient
should fix the problem. However, since I did not manage to reproduce it, it's hard for me to tell whether the change is a fix or a not.
I followed newaz instruction and now I also don't have the error.
Cool, can you submit a pull request with the fix please?
Hi bajtos,
Man you would laugh at my coding skills :) I'm really a newbie.
What I really did for the moment is that I'm using the com.loopj.android:android-async-http:1.4.4 dependency, and not the latest 1.4.6. That solved my issue.
I'll tell you what I'll do, I'm going to go again to the version 1.4.6 and simply change all the HttpClient uses in your library to use AsyncHttpClient, and test again... I will report if the issues are gone then.
If they are gone I'll learn how to make a pull request :)
What I really did for the moment is that I'm using the com.loopj.android:android-async-http:1.4.4 dependency, and not the latest 1.4.6. That solved my issue.
Good, I am glad you managed to find a way how to move forward.
I'll tell you what I'll do, I'm going to go again to the version 1.4.6 and simply change all the HttpClient uses in your library to use AsyncHttpClient, and test again... I will report if the issues are gone then.
Great!
I'll learn how to make a pull request
https://gist.github.com/bajtos/27e3d1545a053d22015b
I should really turn it into a blog post one day.
Miroslav,
I'm having a nightmare trying to compile the library, can you give me some direction? I tried following your DEVELOPING document in the source code, but I cannot make the project compile, gradle keeps throwing errors like: Unable to find method 'org.gradle.api,internal.project.Projetinternal.getConfigurations()Lorg...../ConfigurationsContainerInternal'
This is what I've done: I downloaded all the dependencies you mention regarding the android sdk Gradle is forcing me to change the classpath for gradle from your 0.14.2 to 1.1.0 I also noticed that you use a library in the gradle named : org.apache.commons.io.FilenameUtils; where do you need me to put that? right now the use of that library causes errors in my gradle file under the task distProperties. Gradle is also showing an error under the uploadArchive... MavenDeployment is not recognized.
Beyond that, you also mention that you need me to compile the test-server, but when I do node test-server I get asyn error
I've installed with npm: async, loopback, express, strong-remoting, morgan .. it asked for loopback-component-push and I decided to stop. What are all the dependencies? how can I get them?
I'm sure I'll do better once the sdk is compiled ;)
Gradle is forcing me to change the classpath for gradle from your 0.14.2 to 1.1.0
I think this may be the root of the problem. I haven't had time to updat the project to a newer Android SDK and Build Tools. IIRC there were incompatible changes made after 0.14, I suspect that's causing you problems.
I also noticed that you use a library in the gradle named : org.apache.commons.io.FilenameUtils; where do you need me to put that? right now the use of that library causes errors in my gradle file under the task distProperties.
Gradle should automatically download all dependencies from Maven or jCenter.
Beyond that, you also mention that you need me to compile the test-server, but when I do node test-server I get asyn error
I've installed with npm: async, loopback, express, strong-remoting, morgan .. it asked for loopback-component-push and I decided to stop. What are all the dependencies? how can I get them?
Run npm install
with no parameters in the project root directory. The file package.json should contain all dependencies needed by the test server. Could you please send a pull request to fix the instructions and describe this extra step?
Regarding unit-tests, the steps described in DEVELOPING.md won't work with recent Android Studio versions, because they require newer Gradle. However, it should be possible to run the tests from a command-line too. First start an emulator (e.g. from the Android Studio) and then run the unit-tests via ./gradlew connectedAndroidTest
.
I apologise for the outdated build infrastructure. I have filled a GH issue #67 to fix that, I'll try to get it prioritised for the next sprint.
@yoshuacas I have upgraded the build infrastructure for Android Studio 1.1 in #69 and updated the instructions in DEVELOPING.md. Could you please try again?
I took a look at the problem with AsyncHttpClient vs. HttpClient, it turns out we are using AsyncHttpClient. The confusion was created by a private HttpClient
class extending from AsyncHttpClient
. I have renamed the private class in #70 to make the matter more clear.
This brings me back to my original problem, that I don't know how to reproduce this issue and get IllegalArgumentException
on my machine. Any more clues?
Hi @newaz @yoshuacas @bajtos Is this issue still relevant?
Closing due to inactivity. If you are still running into problems, feel free to leave a comment and I will reopen the issue.
@loay , Not working with android at the moment so can't reayy say if its resolved or not.
Hi All,
I have tried through com.loopj.asynchttpclient 1.4.4 and 1.4.6 .. works well on Emulator.. But does throws Connect Timeout error from device - HTC Android 4.4.2 API 19. Any help will be greatly appreciated. Thanks in advance.
org.apache.http.conn.ConnectTimeoutException: Connect to /192.164.1.18:8080 timed out W/System.err: at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127) W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144) W/System.err: at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) W/System.err: at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:367) W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754) W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:519) W/System.err: at com.loopj.android.http.AsyncHttpRequest.makeRequest(AsyncHttpRequest.java:147) W/System.err: at com.loopj.android.http.AsyncHttpRequest.makeRequestWithRetries(AsyncHttpRequest.java:178) W/System.err: at com.loopj.android.http.AsyncHttpRequest.run(AsyncHttpRequest.java:109) W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) W/System.err: at java.lang.Thread.run(Thread.java:864)
Hi, I am having one issue while using gradle dependencies. if I use,
compile 'com.strongloop:loopback-sdk-android:1+'
(or 1.5.x to be specific) it builds but it fails when the app tries to save a model:I guess it was a mismacth of loopj version. so I removed loopj
1.4.5
from sdk dependency and used1.4.4
as a seperate dependency.And no errors anymore. My android studio version is
0.9
and my gradle is2.2.1
My complete dependency: