httpget unresolvedhostexception

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

httpget unresolvedhostexception

Postby lucj » Wed Dec 23, 2009 9:48 pm

Hello,
I'm quite new on android and try to implement http client to communicate to a REST server. I'm starting with the Get method but I have some problems using android 2.0 on the emulator. 

String url = "http://www.google.fr/search?q=android"
HttpClient client = new DefaultHttpClient(new BasicHttpParams());
 HttpGet getMethod = new HttpGet((url));
 HttpResponse httpResponse = client.execute(getMethod);
HttpEntity = httpResponse.getEntity());
int length = (int) httpEntity.getContentLength();
=> length is -1 :-(

A look into the logs gives me the UnresolvedHostException. 

I searched on google and found several guys having the same problem but who didn't find any answer. Is there a particuliar way to configure the android emulator to have this working ?
Just to precise, I have added the Internet access in the android manifest.

Thanks a lot for your help.
Luc
lucj
Freshman
Freshman
 
Posts: 5
Joined: Tue Dec 22, 2009 10:20 pm

Top

Postby serkan.dogantekin » Tue Dec 29, 2009 9:45 am

Is it possible that you're accessing internet through a proxy?
serkan.dogantekin
Developer
Developer
 
Posts: 27
Joined: Thu Jun 04, 2009 6:12 pm
Location: Istanbul/Turkey

Postby lucj » Tue Dec 29, 2009 10:00 am

Hello,
No I am not behind a proxy.
I read that this could be linked to a DNS problem.
In fact, since yesterday I do not have this error again, it seems that it disappeared when I tryed to access the url from the browser. I do not know what happened behind the scene as I did not modified the code...
Thanks a lot for your reply.
Regards,
Luc
lucj
Freshman
Freshman
 
Posts: 5
Joined: Tue Dec 22, 2009 10:20 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Google [Bot] and 3 guests