- Computers & Software»
- Computer Science & Programming
Tips to solve the UnknownHostException on Android
Lately I've seen so many java and android developers getting the annoying UnknownHostException message while trying to connect the Android emulator to the internet. I've had this problem too and I know it is how much it is really irritating. So I decided to share you guys some of things you should check before trying to make your android connect to web.
- The very first thing is the AndroidManifest.xml, it got to have the permission to connect the internet. So, check if it has the following line (it is a must, don't try anything related to internet before that):
<uses-permission android:name="android.permission.INTERNET" />
2. Test the connection using the web browser, to see if it's a code or an emulator problem.
- To eliminate if the connection problem is from your code or your emulator, run a web browser and try to connect to any trustful web site like www.google.com
3. Check your firewall settings.
4 . Share your network connection (If all fails).
- That one was tricky, I was almost giving up when this idea came to my mind, so I decided in a desperate try, share the connection on windows and BAM! My android emulator finally connected to web. See below the picture to got an idea on how I did this on Windows XP.
So that is it. That was my tips and problems that I found while trying to connect my Android emulator on the web. If you guys have another tip, please comment and share, let´s help each other and stop banging our heads on the desk. :)
Thank you for reading. Take care. See ya.