Here are my Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pa4ad.earthquakeviewer"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permisson.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Earthquake"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I tested these code on a Nexus 7 1st generation, not an emulator. After a complete search online, I found solutions to similar questions and have added the permission INTERNET and ACCESS_NETWORK_STATE, but still get this error.
03-25 11:15:49.909: E/AndroidRuntime(27298): java.lang.SecurityException: Permission denied (missing INTERNET permission?)
03-25 11:15:49.909: E/AndroidRuntime(27298): at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
03-25 11:15:49.909: E/AndroidRuntime(27298): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
03-25 11:15:49.909: E/AndroidRuntime(27298): at java.net.InetAddress.getAllByName(InetAddress.java:215)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:382)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
03-25 11:15:49.909: E/AndroidRuntime(27298): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
there is a spelling mistake in permission
<uses-permission android:name="android.permisson.INTERNET"/>
use this
<uses-permission android:name="android.permission.INTERNET"/>
Ref: http://developer.android.com/training/basics/network-ops/connecting.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With