使用Twiter4j,Android Twitter登录失败

时间:2014-01-22 07:16:37

标签: android twitter4j

我正在使用twiter4j 3.0.3将Twiiter集成到我的应用程序。我使用以下代码进行登录。它之前正在工作。现在它在尝试登录时抛出异常。记录了猫。

ConfigurationBuilder builder = new ConfigurationBuilder();
            builder.setOAuthConsumerKey(Constants.TWITTER_CONSUMER_KEY);
            builder.setOAuthConsumerSecret(Constants.TWITTER_CONSUMER_SECRET);
            Configuration configuration = builder.build();

            TwitterFactory factory = new TwitterFactory(configuration);
            twitter = factory.getInstance();

            try {
                requestToken = twitter.getOAuthRequestToken();
                isSuccess = true;
            } catch (TwitterException e) {
                isSuccess = false;
                e.printStackTrace();
            }

logcat的

 01-22 12:06:27.666: W/System.err(2581): 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
01-22 12:06:27.666: W/System.err(2581): Relevant discussions can be found on the Internet at:
01-22 12:06:27.666: W/System.err(2581):     http://www.google.co.jp/search?q=bfb606ed or
01-22 12:06:27.666: W/System.err(2581):     http://www.google.co.jp/search?q=4ef9707c
01-22 12:06:27.666: W/System.err(2581): TwitterException{exceptionCode=[bfb606ed-4ef9707c], statusCode=403, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.3}
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:177)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:122)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:281)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:273)

3 个答案:

答案 0 :(得分:4)

将twitter4j jar从twiter4j 3.0.3升级到twiter4j 3.0.5,这是一个新版本。

答案 1 :(得分:3)

我们在与twitter连接方面遇到了问题。请用最新的twitter4j 3.0.5jar

替换旧的twitter4j.jar库

链接:

https://www.dropbox.com/s/dt4suej0zkoi997/twitter4j-core-3.0.5.jar

从这里得到它并享受

答案 2 :(得分:2)