title: Cleartext HTTP traffic to my localhost is not permitted
body: <p>I'm using Volley for a GET request to an address on my localhost, but it fails with the error:</p>
  
  <pre><code>Cleartext HTTP traffic to 192.168.1.45 not permitted
  </code></pre>
  
  <p>I followed the guide here: <a href="https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted">Android 8: Cleartext HTTP traffic not permitted</a>
  And did the following:</p>
  
  <p>Created the network security xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;network-security-config&gt;
      &lt;domain-config cleartextTrafficPermitted="true"&gt;
          &lt;domain includeSubdomains="true"&gt;http://192.168.1.45/companyweb/greetings&lt;/domain&gt;
      &lt;/domain-config&gt;
  &lt;/network-security-config&gt;
  </code></pre>
  
  <p>Added it in my manifest and also allowed cleartext traffic:</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.omerfaran.myudemyapp"&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
      &lt;application
          android:networkSecurityConfig="@xml/network_security_config"
          android:usesCleartextTraffic="true"
  </code></pre>
  
  <p>I'm still getting the same error. Changing from 'http' to 'https' gives this error:</p>
  
  <pre><code>socket failed: EPERM (Operation not permitted)
  </code></pre>
  
  <p>My code in MainActivity:</p>
  
  <pre><code>val url = "http://192.168.1.45/companyweb/greetings"
  val rq = Volley.newRequestQueue(this)
  val sr = StringRequest(Request.Method.GET, url, Response.Listener { response -&gt;
      fragmentText.text = response
      Log.d("TAG", "success")
  }, Response.ErrorListener { error -&gt; Log.d("TAG", "fail" + error.toString()) })
  rq.add(sr)
  </code></pre>
  
  <p>What can I do next?</p>