Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Unresolved Host Exception

 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to connect to a URL, open a stream and read from it. I have the following statements in my code:


Also, I started my emulator with -http-proxy option since, I am sitting behind a firewall and access internet via a proxy.

I get Unresolved Host Exception here. I can browse to this URL from the broswer of my emulator but not through the code, which I somehow find strange.

 
Author
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you add the INTERNET permission to your AndroidManifest.xml file?
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes: <uses-permission android:name="android.permission.INTERNET" />

I have also configured the proxy in the System table of the device(added a row in the system table)

sqlite> insert into system values(99,'http_proxy',<proxy:port>);

I restarted my emulator and now when I run the code as:



I see FileNotFoundException in Log. Not sure what I am missing here.

Thanks.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read about Local Networking Limitations of Emulator; could this be a problem even after configuring the proxy and everything?

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic