开发者

"Permission denied" while connecting to a page, even with INTERNET permission

While connecting to any page drom Android, i get this exception:

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)
...

The permission

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

is added to Manifest file and shows up in editor as used.

What could be possible causes?

开发者_Python百科
<?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>


In my case, I was getting this error due to an issue with a firewall blocking the connection. Also, I'm not exactly sure what the nature of your connection is but apparently redirects can also cause a similar exception to be thrown.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜