2010-12-19 94 views
0

Facebook的Android SDK中運行時,應用程序例如給予Facebook的Android SDK中的UnknownHostException

11-14 23:17:58.484: ERROR/HttpOperation.run(1139): class java.net.UnknownHostException api.facebook.com [http://api.facebook.com/restserver.php?api_key=882a8490361da98702bf97a021ddc14d&call_id=1289744278460&format=JSON&method=fql.query&migrations_override=%7B%27empty_json%27%3A+true%7D&query=SELECT+uid%2Cfirst_name%2Clast_name%2Cname%2Cpic_square%2Ccell%2Cother_phone%2Ccontact_email%2Cbirthday_date+FROM+user+WHERE+%28uid+IN+%28SELECT+uid2+FROM+friend+WHERE+uid1%3D1825058169%29%29%3B&session_key=f9902bc179f7592f8ed273ed-1825058169&sig=e299638eb114e77fef3eb2088f270683&v=1.0] 
11-14 23:17:58.484: ERROR/HttpOperation(1139): Encountered exception: java.net.UnknownHostException: api.facebook.com 
11-14 23:17:58.484: WARN/System.err(1139): java.net.UnknownHostException: api.facebook.com 
11-14 23:17:58.484: WARN/System.err(1139): at java.net.InetAddress.lookupHostByName(InetAddress.java:513) 
11-14 23:17:58.484: WARN/System.err(1139): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:278) 
11-14 23:17:58.484: WARN/System.err(1139): at java.net.InetAddress.getAllByName(InetAddress.java:242) 
11-14 23:17:58.484: WARN/System.err(1139): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136) 
11-14 23:17:58.484: WARN/System.err(1139): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 
11-14 23:17:58.484: WARN/System.err(1139): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 
11-14 23:17:58.484: WARN/System.err(1139): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348) 
11-14 23:17:58.484: WARN/System.err(1139): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 
11-14 23:17:58.484: WARN/System.err(1139): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 
11-14 23:17:58.484: WARN/System.err(1139): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 
11-14 23:17:58.484: WARN/System.err(1139): at com.facebook.katana.service.method.HttpOperation.run(HttpOperation.java:163) 
+1

這是仿真器還是真實設備?我會懷疑你沒有網絡連接。 – techiServices 2010-12-19 10:08:12

+0

UnknownHostException是我每次在沒有連接的情況下發出HTTP請求時在代碼中獲得的內容。來自仿真器的 – 2010-12-19 10:14:45

+0

,來自真實設備的認證窗口進入和離開不執行任何操作。 – om252345 2010-12-19 10:17:38

回答

4

您需要添加使用互聯網的應用程序的權限。如果你不這樣做,應用程序會拋出這個錯誤。

進入清單,並加入這一行:

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

我在我的手機上收到這些錯誤。我去了

settings> applications> manageappatoins> facebook> clear data。

解決了我手機上的問題。