Kap*_*l D 0 java url android http
我只是想尝试访问Earthquake API,我正面临着这个错误.
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)
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)
您是否已在AndroidManifest.xml文件中为您的应用程序提供了INTERNET权限?
你应该有一个类似下面的行:
<uses-permission android:name="android.permission.INTERNET"/>
Run Code Online (Sandbox Code Playgroud)