title: NanoHTTPD EACCES (Permission denied) on Android 4.0.4, 4.4.4 ok
body: <p>I set my permissions in AndroidManifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/&gt;
  </code></pre>
  
  <p>And it's my java code:</p>
  
  <pre><code>public class AndroidWebServerActivity extends Activity
  {
      private WebServer server;
  
      /**
       * Called when the activity is first created.
       */
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          server = new WebServer();
          try
          {
              server.start();
          } catch (IOException ioe)
          {
              Log.w("Httpd", "The server could not start.");
          }
          Log.w("Httpd", "Web server initialized.");
      }
  
  
      // DON'T FORGET to stop the server
      @Override
      public void onDestroy()
      {
          super.onDestroy();
          if (server != null)
              server.stop();
      }
  
      private class WebServer extends NanoHTTPD
      {
  
          public WebServer()
          {
              super(8080);
          }
  
          @Override
          public Response serve(String uri, Method method,
                                Map&lt;String, String&gt; header,
                                Map&lt;String, String&gt; parameters,
                                Map&lt;String, String&gt; files)
          {
  
  
              String answer = "&lt;form name=\"input\" action=\"restart\" method=\"get\"&gt;\n" +
                      "Reset polaczenia danych&lt;br&gt;\n" +
                      "&lt;input type=\"submit\" value=\"Zresetuj polaczenie\"&gt;\n" +
                      "&lt;/form&gt;";
  
              if (uri.startsWith("/restart"))
              {
                  boolean result = ResetMobileData();
  
                  if (result == true)
                      answer = "&lt;font color=\"green\"&gt;Polaczenie zrestartowane&lt;/font&gt;";
                  else
                      answer = "&lt;font color=\"red\"&gt;Resetowanie polaczenia nieudane!&lt;/font&gt;";
              }
              //else
              //{
              //    answer = "Brak komendy";
              //}
  
  
              return new NanoHTTPD.Response(answer);
          }
  </code></pre>
  
  <p>It works without any problems on KitKat. But not in ICS 4.0.4. When I try to run this on ICS, server starts without any problems. But when I try to access server on port 8080, it throws exception " Error: open failed: EACCES (Permission denied)" in method Serve and there is no data returned as response.</p>
  
  <p>What's the problem? Am I missing some permissions? But on KitKat everything works, so..?</p>