String login_url = "http://192.168.1.2/login.php";
URL url = new URL(login_url");
HttpURLConnection httpURLConnection =
(HttpURLConnection)url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
OutputStream outputStream = httpURLConnection.getOutputStream();
....
I want to send a request to wampserver but Android Studio stops the execution with that message on the title. What is wrong? I just updated my Android Studio to the latest version (P). That wasn't an error before and I could work properly... How can I fix this?
According to Network security configuration -
Also have a look at - https://koz.io/android-m-and-the-war-on-cleartext-traffic/
Option 1 -
Create file res/xml/network_security_config.xml -
AndroidManifest.xml -
Option 2 -
AndroidManifest.xml -
Also as @david.s' answer pointed out
android:targetSandboxVersion
can be a problem too -According to Manifest Docs -
So Option 3 -
If you have
android:targetSandboxVersion
in<manifest>
then reduce it to1
AndroidManifest.xml -