我在我的 android 应用程序中遇到了 http post 请求的问题:
libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
我的应用程序在大多数 Android 设备上运行良好,除了一部 android 手机,我的应用程序无法通过该手机上的 http 连接到互联网。但其他应用程序可以在该安卓手机上运行良好,例如浏览器。
我发现有一些关于的问题EACCES (Permission denied)
,我在我的应用程序中检查了<uses-permission android:name="android.permission.INTERNET" />
权限,没有问题。
这是堆栈跟踪:
java.net.SocketException: socket failed: EACCES (Permission denied)
at libcore.io.IoBridge.socket(IoBridge.java:573)
at java.net.PlainSocketImpl.create(PlainSocketImpl.java:201)
at java.net.Socket.checkOpenAndCreate(Socket.java:693)
at java.net.Socket.connect(Socket.java:837)
at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:188)
at cn.com.fetion.android.common.ability.HttpProxy.openDataOutputStream(HttpProxy.java:252)
at cn.com.fetion.javacore.v11.network.HttpConnectionThread.doSendMessage(HttpConnectionThread.java:188)
at cn.com.fetion.javacore.v11.network.HttpConnectionThread.doSendMessage(HttpConnectionThread.java:262)
at cn.com.fetion.javacore.v11.network.HttpConnectionThread.doSendMessage(HttpConnectionThread.java:262)
at cn.com.fetion.javacore.v11.network.HttpConnectionThread.doSendMessage(HttpConnectionThread.java:262)
at cn.com.fetion.javacore.v11.network.ConnectionThread.executeConnectionRequest(ConnectionThread.java:185)
at cn.com.fetion.javacore.v11.network.ConnectionThread.run(ConnectionThread.java:137)
at cn.com.fetion.javacore.v11.network.HttpConnectionThread.run(HttpConnectionThread.java:1)
Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
at libcore.io.Posix.socket(Native Method)
at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181)
at libcore.io.IoBridge.socket(IoBridge.java:558)