Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.net.SocketException: socket failed: EPERM (Operation not permitted)

Solved: All I needed to do was to uninstall the app from the emulator or physical connected device and run it again.


Just uninstall the app from the emulator then run again and it’ll work. I had the same issue

To uninstall the app run your project when "the application had stopped" message appear click "app info" then uninstall.


First of all you need change your android manifest .xml But after this action you must uninstall application and run it again. https://developer.android.com/training/basics/network-ops/connecting

and code here:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

in AndroidManifest.xml


If you forgot to add <uses-permission android:name="android.permission.INTERNET" /> to your Manifest.xml, do it now

If you already added it but the error persists, uninstall the app first then run i again.
More often than not I run into the same issue because I forgot <uses-permission android:name="android.permission.INTERNET" /> in my first installation.
The OS thought the app doesn't need Internet permission (which is dumb IMO) and would not check any permission update to the app (which is even dumber IMO).

The only way to tell the Android OS to check your updated permission requests is to uninstall the app first before installing again.

I think neither

  • <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  • nor android:usesCleartextTraffic="true" really matters here

I had to uninstall the app from the emulator and then everything started to work. I just needed the folowing permission on the AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />