Recently I was messing around on Android with the BrowserView’s and BrowserIntent’s. When trying out one of the examples, I got:
InetAddress: Unknown host www.google.com throwing UnknownHostException
Every URL I entered, it displayed a “Page cannot be found” type error. At first I thought it was the site I was trying to use, but obviously sites like Google were up. Then I thought it might be the network connection on the emulator, but I tested its browser application and it worked fine. So that left my application.
It turns out that if you don’t have permission to use the internet, and try to – even if it is to launch the browser (and not run your own), your request is denied. Fairly good idea, in the end, although the lack of error message makes it a bit difficult to track down. In the end I realized this lack of permission was the issue and added the necessary permission (below) to my AndroidManifest.xml file.
<uses-permission android:name=”android.permission.INTERNET” />
After that and a quick rebuild, the application was much happier. I was free to abuse the internet once again. (Editor’s note: Cue maniacal laughter.)