2011-06-09 74 views
2

當連接到任何頁面DROM的Android,我得到這個異常:拒絕「權限」,而連接到一個頁面,甚至INTERNET權限

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" /> 

添加的體現文件並在編輯器中顯示。

可能的原因是什麼?

<?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> 
+4

請顯示完整的AndroidManifest - 使用權限的位置可以有所作爲。 – Haphazard 2011-06-09 12:59:32

+0

感謝這個問題!我得到了錯誤,因爲我在我的清單中忘記了「<使用權限android:name =」android.permission.INTERNET「/>」。 – thedrs 2013-05-12 05:03:05

回答

0

在我的情況下,由於阻止連接的防火牆問題,我得到此錯誤。另外,我不確定連接的性質,但顯然重定向也會導致similar exception to be thrown

+0

看來,防火牆是問題,謝謝。 – Demonick 2011-06-09 13:38:40