title: Volley & Android internet permission not working
body: <p>I'm trying to use volley.</p>
  
  <p>This is my android manifest: (i've added access_network_state because of suggestion but not really needed i think)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.informaticalab.volleyexample" &gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
  
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>And this is the logcat:</p>
  
  <pre><code>12-20 18:02:02.804  32718-32741/com.informaticalab.volleyexample E/Volley﹕ [10218] NetworkDispatcher.run: Unhandled exception java.lang.SecurityException: Permission denied (missing INTERNET permission?)
      java.lang.SecurityException: Permission denied (missing INTERNET permission?)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
       Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
              at libcore.io.Posix.android_getaddrinfo(Native Method)
              at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
       Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
              at libcore.io.Posix.android_getaddrinfo(Native Method)
              at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
  12-20 18:02:56.885      720-743/com.informaticalab.volleyexample E/Volley﹕ [10263] NetworkDispatcher.run: Unhandled exception java.lang.SecurityException: Permission denied (missing INTERNET permission?)
      java.lang.SecurityException: Permission denied (missing INTERNET permission?)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
       Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
              at libcore.io.Posix.android_getaddrinfo(Native Method)
              at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
       Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
              at libcore.io.Posix.android_getaddrinfo(Native Method)
              at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
  12-20 18:04:31.940    1819-1841/com.informaticalab.volleyexample E/Volley﹕ [10403] NetworkDispatcher.run: Unhandled exception java.lang.SecurityException: Permission denied (missing INTERNET permission?)
      java.lang.SecurityException: Permission denied (missing INTERNET permission?)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
       Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
              at libcore.io.Posix.android_getaddrinfo(Native Method)
              at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
       Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
              at libcore.io.Posix.android_getaddrinfo(Native Method)
              at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
              at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
              at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
              at java.net.InetAddress.getAllByName(InetAddress.java:215)
              at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29)
              at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232)
              at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124)
              at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:272)
              at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
              at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:491)
              at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:109)
              at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
              at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
  </code></pre>
  
  <p>I' m not sure what i'm doing wrong. Even if the logcat says that there is a permission problem, i would like to attach my main activity too:</p>
  
  <pre><code>package com.informaticalab.volleyexample;
  
  import android.content.Context;
  import android.graphics.Bitmap;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.TextView;
  
  import com.android.volley.Request;
  import com.android.volley.RequestQueue;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.ImageLoader;
  import com.android.volley.toolbox.JsonObjectRequest;
  import com.android.volley.toolbox.Volley;
  
  import org.json.JSONObject;
  
  
  public class MainActivity extends ActionBarActivity
  {
  
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          final TextView mTxtDisplay = (TextView) findViewById(R.id.txtview);
          String url = "";
  
          JsonObjectRequest jsObjRequest = new JsonObjectRequest
                  (Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;()
                  {
  
                      @Override
                      public void onResponse(JSONObject response)
                      {
                          mTxtDisplay.setText("Response: " + response.toString());
                      }
                  }, new Response.ErrorListener()
                  {
  
                      @Override
                      public void onErrorResponse(VolleyError error)
                      {
                          mTxtDisplay.setText("Response: Oooops!");
                      }
                  });
  
  // Access the RequestQueue through your singleton class.
          MySingleton.getInstance(this).addToRequestQueue(jsObjRequest);
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu)
      {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item)
      {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings)
          {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      private static class MySingleton
      {
          private static MySingleton mInstance;
          private RequestQueue mRequestQueue;
          private ImageLoader mImageLoader;
          private static Context mCtx;
  
          private MySingleton(Context context)
          {
              mCtx = context;
              mRequestQueue = getRequestQueue();
  
              mImageLoader = new ImageLoader(mRequestQueue,
                                             new ImageLoader.ImageCache()
                                             {
                                                 private final android.support.v4.util
                                                         .LruCache&lt;String, Bitmap&gt;
                                                         cache = new android.support.v4.util
                                                         .LruCache&lt;String, Bitmap&gt;(
                                                         20);
  
                                                 @Override
                                                 public Bitmap getBitmap(String url)
                                                 {
                                                     return cache.get(url);
                                                 }
  
                                                 @Override
                                                 public void putBitmap(String url, Bitmap bitmap)
                                                 {
                                                     cache.put(url, bitmap);
                                                 }
                                             });
          }
  
          public static synchronized MySingleton getInstance(Context context)
          {
              if (mInstance == null)
              {
                  mInstance = new MySingleton(context);
              }
              return mInstance;
          }
  
          public RequestQueue getRequestQueue()
          {
              if (mRequestQueue == null)
              {
                  // getApplicationContext() is key, it keeps you from leaking the
                  // Activity or BroadcastReceiver if someone passes one in.
                  mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
              }
              return mRequestQueue;
          }
  
          public &lt;T&gt; void addToRequestQueue(Request&lt;T&gt; req)
          {
              getRequestQueue().add(req);
          }
  
          public ImageLoader getImageLoader()
          {
              return mImageLoader;
          }
      }
  
  }
  </code></pre>