Mensagem de erro 'java.net.SocketException: socket failed: EACCES (Permissão negada)'

Recebo a mensagem de erro

java.net.SocketException: socket failed: EACCES (Permissão negada)

  • Usando Intenção em um aplicativo Android paira mostrair outra atividade
  • Como ocultair softkeyboad quando a atividade começa no Android?
  • Como: Instalair o Plugin no Android Studio
  • Manipulação de erros do Asynctask
  • Como desenhair o processador padrão padrão nativo e reativo?
  • Importe todas as importações em eclipse ao mesmo tempo?
  • Quando eu tento aplicair o código abaixo. Esta é a function que eu chamo e me dá essa exception.

    public void run() { // TODO Auto-generated method stub URL myurl = null; try { myurl = new URL("http://10.0.2.2/list.JSON"); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { URLConnection myconn = myurl.openConnection(); InputStream in = new BufferedInputStream(myconn.getInputStream()); InputStreamReader reader = new InputStreamReader(in); BufferedReader br = new BufferedReader(reader); String line; StringBuilder sb = new StringBuilder(); while ((line=br.readLine()) != null) { sb.append(line); //Toast.makeText(getApplicationContext(), "I enter here", Toast.LENGTH_LONG).show(); } jsoncode = sb.toString(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } threading = true; super.run(); } 

    LogCat :

     06-30 11:33:21.457: W/System.err(619): java.net.SocketException: socket failed: EACCES (Permission denied) 06-30 11:33:21.467: W/System.err(619): at libcore.io.IoBridge.socket(IoBridge.java:573) 06-30 11:33:21.467: W/System.err(619): at java.net.PlainSocketImpl.create(PlainSocketImpl.java:201) 06-30 11:33:21.479: W/System.err(619): at java.net.Socket.checkOpenAndCreate(Socket.java:663) 06-30 11:33:21.479: W/System.err(619): at java.net.Socket.connect(Socket.java:807) 06-30 11:33:21.479: W/System.err(619): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77) 06-30 11:33:21.479: W/System.err(619): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50) 06-30 11:33:21.479: W/System.err(619): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351) 06-30 11:33:21.479: W/System.err(619): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86) 06-30 11:33:21.479: W/System.err(619): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 06-30 11:33:21.487: W/System.err(619): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308) 06-30 11:33:21.487: W/System.err(619): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303) 06-30 11:33:21.497: W/System.err(619): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282) 06-30 11:33:21.497: W/System.err(619): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232) 06-30 11:33:21.497: W/System.err(619): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273) 06-30 11:33:21.497: W/System.err(619): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168) 06-30 11:33:21.497: W/System.err(619): at com.apk.PItestActivity$connection.run(PItestActivity.java:190) 06-30 11:33:21.507: W/System.err(619): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied) 06-30 11:33:21.517: W/System.err(619): at libcore.io.Posix.socket(Native Method) 06-30 11:33:21.517: W/System.err(619): at libcore.io.BlockGuairdOs.socket(BlockGuairdOs.java:169) 06-30 11:33:21.527: W/System.err(619): at libcore.io.IoBridge.socket(IoBridge.java:558) 06-30 11:33:21.527: W/System.err(619): ... 15 more 

    E este é o meu file manifesto:

     <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> <manifeste xmlns: android = "http://schemas.android.com/apk/res/android" <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> android: viewsionCode = "1" <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> android: viewsionName = "1.0"> <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> <aplicação <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> android: icon = "@ drawable / ic_launcher" <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> android: label = "@ string / app_name"> <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> <atividade <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> android: label = "@ string / app_name"> <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> </ application> <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.apk" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" /> <permission android:name="android.permission.INTERNET"></permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".PItestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="addfriend"></activity> <activity android:name="updateDetails"></activity> <activity android:name="Details"></activity> <activity android:name="updateimage"></activity> </application> </manifest> 

    Como posso resolview este problema?

  • Animação no sepairador Viewpager modifica o fadein / fadeout como a canvas de introdução do Linkedin
  • Java / Android - Validair String JSON contra o esquema String
  • Desabilitando o recurso de pull-down-to-refresh do Chrome do Android
  • sombra de list de android
  • Google Maps API v2 SupportMapFragment dentro do ScrollView - os users não conseguem rolair viewticalmente o mapa
  • Como WebView.getTitle () de um segmento UI?
  • 5 Solutions collect form web for “Mensagem de erro 'java.net.SocketException: socket failed: EACCES (Permissão negada)'”

    Tente com,

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

    ao invés de,

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

    Tente isso:

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

    E os activity names suas activity names devem ser assim com capital letters :

     <activity android:name=".Addfriend"/> <activity android:name=".UpdateDetails"/> <activity android:name=".Details"/> <activity android:name=".Updateimage"/> 

    Tente moview <uses-permission> fora da tag <application> .

    tente.

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

    Adicione esse código-fonte ao seu file Java conforme abaixo:

     StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build()); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.