Home » Android » android – UnknownHostException when accessing api.twitter.com

android – UnknownHostException when accessing api.twitter.com

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m trying to access this list of public twitts here,
from an android application through a HttpClient:

http://api.twitter.com/1/statuses/public_timeline.json

I keep getting an Exception when connecting:

java.net.UnknownHostException: api.twitter.com

Why is this happening?
How can I fix this?

Thank you

How to&Answers:

Make sure you have the INTERNET permission added to your manifest.

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