简体   繁体   English

在android 4.0.3中发布到Facebook墙的消息出错

[英]Error on post message to the facebook wall in android 4.0.3

I try to post message on user facebook wall. 我尝试在用户Facebook墙上发布消息。 It's work on previous platform versions, but on Android 4.0.3 I have error: 它适用于以前的平台版本,但在Android 4.0.3上我有错误:

    07-19 14:53:02.945: W/System.err(29740): java.net.UnknownHostException: Unable to resolve host "graph.facebook.com": No address associated with hostname
07-19 14:53:02.965: W/System.err(29740):    at java.net.InetAddress.lookupHostByName(InetAddress.java:436)
07-19 14:53:02.965: W/System.err(29740):    at java.net.InetAddress.getAllByNameImpl(InetAddress.java:245)
07-19 14:53:02.965: W/System.err(29740):    at java.net.InetAddress.getAllByName(InetAddress.java:220)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:460)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:441)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
07-19 14:53:02.965: W/System.err(29740):    at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
07-19 14:53:02.975: W/System.err(29740):    at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
07-19 14:53:02.975: W/System.err(29740):    at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:164)
07-19 14:53:02.975: W/System.err(29740):    at com.facebook.android.Util.openUrl(Util.java:193)
07-19 14:53:02.975: W/System.err(29740):    at com.facebook.android.Facebook.request(Facebook.java:751)
07-19 14:53:02.975: W/System.err(29740):    at com.koloneme.socialnetworking.FacebookUtility.postOnWall(FacebookUtility.java:115)
07-19 14:53:02.975: W/System.err(29740):    at com.koloneme.socialnetworking.FacebookUtility.facebookAuthorization(FacebookUtility.java:65)
07-19 14:53:02.975: W/System.err(29740):    at com.koloneme.socialnetworking.FacebookActivity.onCreate(FacebookActivity.java:33)
07-19 14:53:02.975: W/System.err(29740):    at android.app.Activity.performCreate(Activity.java:4538)
07-19 14:53:02.975: W/System.err(29740):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
07-19 14:53:02.975: W/System.err(29740):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
07-19 14:53:02.975: W/System.err(29740):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2237)
07-19 14:53:02.975: W/System.err(29740):    at android.app.ActivityThread.access$600(ActivityThread.java:139)
07-19 14:53:02.975: W/System.err(29740):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
07-19 14:53:02.975: W/System.err(29740):    at android.os.Handler.dispatchMessage(Handler.java:99)
07-19 14:53:02.975: W/System.err(29740):    at android.os.Looper.loop(Looper.java:154)
07-19 14:53:02.975: W/System.err(29740):    at android.app.ActivityThread.main(ActivityThread.java:4974)
07-19 14:53:02.975: W/System.err(29740):    at java.lang.reflect.Method.invokeNative(Native Method)
07-19 14:53:02.975: W/System.err(29740):    at java.lang.reflect.Method.invoke(Method.java:511)
07-19 14:53:02.975: W/System.err(29740):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-19 14:53:02.975: W/System.err(29740):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-19 14:53:02.975: W/System.err(29740):    at dalvik.system.NativeStart.main(Native Method)
07-19 14:53:02.975: W/System.err(29740): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
07-19 14:53:02.975: W/System.err(29740):    at libcore.io.Posix.getaddrinfo(Native Method)
07-19 14:53:02.975: W/System.err(29740):    at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
07-19 14:53:02.975: W/System.err(29740):    at java.net.InetAddress.lookupHostByName(InetAddress.java:421)
07-19 14:53:02.975: W/System.err(29740):    ... 33 more
07-19 14:53:03.075: W/webcore(29740): java.lang.Throwable: EventHub.removeMessages(int what = 105) is not supported before the WebViewCore is set up.
07-19 14:53:03.075: W/webcore(29740):   at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1889)
07-19 14:53:03.075: W/webcore(29740):   at android.webkit.WebViewCore$EventHub.access$8500(WebViewCore.java:973)
07-19 14:53:03.075: W/webcore(29740):   at android.webkit.WebViewCore.removeMessages(WebViewCore.java:2088)
07-19 14:53:03.075: W/webcore(29740):   at android.webkit.WebView.sendViewSizeZoom(WebView.java:3450)
07-19 14:53:03.075: W/webcore(29740):   at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:679)
07-19 14:53:03.075: W/webcore(29740):   at android.webkit.ZoomManager.access$1900(ZoomManager.java:59)
07-19 14:53:03.075: W/webcore(29740):   at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:1174)
07-19 14:53:03.075: W/webcore(29740):   at android.os.Handler.handleCallback(Handler.java:607)
07-19 14:53:03.075: W/webcore(29740):   at android.os.Handler.dispatchMessage(Handler.java:92)
07-19 14:53:03.075: W/webcore(29740):   at android.os.Looper.loop(Looper.java:154)
07-19 14:53:03.075: W/webcore(29740):   at android.app.ActivityThread.main(ActivityThread.java:4974)
07-19 14:53:03.075: W/webcore(29740):   at java.lang.reflect.Method.invokeNative(Native Method)
07-19 14:53:03.075: W/webcore(29740):   at java.lang.reflect.Method.invoke(Method.java:511)
07-19 14:53:03.075: W/webcore(29740):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-19 14:53:03.075: W/webcore(29740):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-19 14:53:03.075: W/webcore(29740):   at dalvik.system.NativeStart.main(Native Method)

I'm using this facebook sdk - https://github.com/facebook/facebook-android-sdk/ 我正在使用这个facebook sdk - https://github.com/facebook/facebook-android-sdk/

Here is my code to posting message on wall: 这是我在墙上发布消息的代码:

 private static void postOnWall(String msg) {
            Log.d(LOGTAG, "Testing graph API wall post");
             try {
                 //   String response = facebook.request("me");
                    Bundle parameters = new Bundle();
                    parameters.putString("message", msg);
                    parameters.putString("description", "test test test");
                    String response = facebook.request("me/feed", parameters, 
                            "POST");
                    Log.d(LOGTAG, "got response: " + response);
                    if (response == null || response.equals("") || 
                            response.equals("false")) {
                       Log.v(LOGTAG, " error Blank response");
                    }
             } catch(Exception e) {
                 e.printStackTrace();
             }
        }

There are three reasons that you would get this exception: 您将获得此异常有三个原因:

  1. You have not declared the internet permission in your manifest 您尚未在清单中声明互联网权限
  2. The device does not have an internet connection, or has one which blocks facebook access at the DNS level. 该设备没有互联网连接,或者有一个阻止DNS访问DNS级别的设备。 Try using a home network if you're behind a company porxy. 如果你在公司porxy后面,请尝试使用家庭网络。
  3. Facebook's server's are temporarily not working. Facebook的服务器暂时无法正常工作。

i get 我明白了

got response: {"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}} 得到回复:{“error”:{“message”:“必须使用活动访问令牌来查询有关当前用户的信息。”,“type”:“OAuthException”,“code”:2500}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM