在连接Android的任何页面时,我都会遇到以下异常:
06-09 12:50:42.725: WARN/System.err(1080): java.net.SocketException: Permission denied
06-09 12:50:42.835: WARN/ActivityManager(38): Launch timeout has expired, giving up wake lock!
06-09 12:50:43.003: WARN/System.err(1080): at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocketImpl(Native Method)
06-09 12:50:43.003: WARN/System.err(1080): at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocket(OSNetworkSystem.java:186)
06-09 12:50:43.014: WARN/System.err(1080): at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:265)
06-09 12:50:43.014: WARN/System.err(1080): at java.net.Socket.checkClosedAndCreate(Socket.java:873)
06-09 12:50:43.066: WARN/System.err(1080): at java.net.Socket.connect(Socket.java:1020)
06-09 12:50:43.066: WARN/System.err(1080): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
06-09 12:50:43.073: WARN/System.err(1080): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
06-09 12:50:43.073: WARN/System.err(1080): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
06-09 12:50:43.083: WARN/System.err(1080): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
06-09 12:50:43.083: WARN/System.err(1080): at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:350)
06-09 12:50:43.083: WARN/System.err(1080): at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:337)
06-09 12:50:43.093: WARN/System.err(1080): at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:135)
06-09 12:50:43.093: WARN/System.err(1080): at org.jsoup.helper.HttpConnection.get(HttpConnection.java:124)
06-09 12:50:43.150: WARN/System.err(1080): at com.amberphone.lulekcijas.connector.PageConnector.getContentElement(PageConnector.java:24)
...
许可
<uses-permission android:name="android.permission.INTERNET" />
被添加到Manifest文件中,并在编辑器中显示为已使用。
可能的原因是什么?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amberphone.lulekcijas"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".PageTestActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
答案 0 :(得分:0)
在我的情况下,由于防火墙阻止连接的问题,我收到此错误。此外,我不确定您的连接的性质是什么,但显然重定向也可能导致similar exception to be thrown。