我试图将Twitter集成到我的应用程序,每次按下登录按钮,这都会出现在log cat中,没有任何反应。我的分叉项目是https://github.com/daiweilu/TwitterLoginExample/blob/master/TwitterLoginExample
我正在尝试4个小时,但根本没有希望
05-20 21:22:41.359: W/System.err(10294): api.twitter.com
05-20 21:22:41.359: W/System.err(10294): Relevant discussions can be found on the Internet at:
05-20 21:22:41.359: W/System.err(10294): http://www.google.co.jp/search?q=8e063946 or
05-20 21:22:41.359: W/System.err(10294): http://www.google.co.jp/search?q=ef59cf9f
05-20 21:22:41.359: W/System.err(10294): TwitterException{exceptionCode=[8e063946-ef59cf9f 8e063946-ef59cf75], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=4.0.1}
05-20 21:22:41.359: W/System.err(10294): at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:179)
05-20 21:22:41.359: W/System.err(10294): at twitter4j.HttpClientBase.request(HttpClientBase.java:53)
05-20 21:22:41.359: W/System.err(10294): at twitter4j.HttpClientBase.post(HttpClientBase.java:82)
05-20 21:22:41.359: W/System.err(10294): at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:116)
05-20 21:22:41.359: W/System.err(10294): at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:98)
05-20 21:22:41.359: W/System.err(10294): at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:287)
05-20 21:22:41.359: W/System.err(10294): at tk.pidevelopers.floata.MainActivity$GetRequestTokenTask.doInBackground(MainActivity.java:87)
05-20 21:22:41.359: W/System.err(10294): at tk.pidevelopers.floata.MainActivity$GetRequestTokenTask.doInBackground(MainActivity.java:1)
05-20 21:22:41.359: W/System.err(10294): at android.os.AsyncTask$2.call(AsyncTask.java:185)
05-20 21:22:41.359: W/System.err(10294): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
05-20 21:22:41.359: W/System.err(10294): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
05-20 21:22:41.359: W/System.err(10294): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
05-20 21:22:41.367: W/System.err(10294): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
05-20 21:22:41.367: W/System.err(10294): at java.lang.Thread.run(Thread.java:1019)
05-20 21:22:41.367: W/System.err(10294): Caused by: java.net.UnknownHostException: api.twitter.com
05-20 21:22:41.367: W/System.err(10294): at java.net.InetAddress.lookupHostByName(InetAddress.java:497)
05-20 21:22:41.367: W/System.err(10294): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
05-20 21:22:41.367: W/System.err(10294): at java.net.InetAddress.getAllByName(InetAddress.java:256)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:69)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:406)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeConnection(HttpsURLConnectionImpl.java:387)
05-20 21:22:41.367: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205)
05-20 21:22:41.375: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:614)
05-20 21:22:41.375: W/System.err(10294): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:268)
05-20 21:22:41.375: W/System.err(10294): at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:137)
其他信息:我使用twitter4J 4.0.1最新版本并使用了许多其他版本
答案 0 :(得分:0)
看起来您无法访问Twitter的API服务器。你是否正在通过代理?如果是这种情况,这可能会有所帮助:
查看&#34; HTTP代理服务器&#34;下的here。您需要将ConfigurationBuilder设置为使用代理。像这样:
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
...
.setHttpProxyHost(proxyHost)
.setHttpProxyPort(proxyPort);
希望这有帮助。