2012-03-22 59 views
0

我只是想訪問地震API,我正面臨着這個錯誤。在Android中訪問地震API。 UnknownHostException

03-22 00:55:27.805: W/System.err(1044): java.net.UnknownHostException: Unable to resolve host "earthquake.usgs.gov": No address associated with hostname 03-22 00:55:27.815: W/System.err(1044): at java.net.InetAddress.lookupHostByName(InetAddress.java:426) 03-22 00:55:27.815: W/System.err(1044): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242) 03-22 00:55:27.815: W/System.err(1044): at java.net.InetAddress.getAllByName(InetAddress.java:220)

回答

6

你有沒有在AndroidManifest.xml文件給你的應用程序the INTERNET permission

你應該像有如下一行:

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