HttpURLConnection connect returns unknownhostexception


This is what you get when you dont enable INTERNET permission in your android manifest file.

05-06 07:07:55.984: WARN/System.err(1006): java.net.UnknownHostException: gdata.youtube.com
05-06 07:07:55.984: WARN/System.err(1006):     at java.net.InetAddress.lookupHostByName(InetAddress.java:506)
05-06 07:07:55.984: WARN/System.err(1006):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
05-06 07:07:55.984: WARN/System.err(1006):     at java.net.InetAddress.getAllByName(InetAddress.java:256)
05-06 07:07:55.984: WARN/System.err(1006):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:68)
05-06 07:07:55.984: WARN/System.err(1006):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
05-06 07:07:55.984: WARN/System.err(1006):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:298)
05-06 07:07:55.984: WARN/System.err(1006):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
05-06 07:07:55.984: WARN/System.err(1006):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
05-06 07:07:55.984: WARN/System.err(1006):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
05-06 07:07:55.984: WARN/System.err(1006):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205)

To fix it add the following into the androidmanifest.xml file.

<uses-permission android:name="android.permission.INTERNET" />
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s