03-07 12:48:06.605: W/System.err(1582): 403:The request is understood, but it has been refused. An accompanying error message will explain why.
03-07 12:48:06.605: W/System.err(1582): {"error":"Status is a duplicate.","request":"\/1\/statuses\/update.json"}
03-07 12:48:06.605: W/System.err(1582): TwitterException{exceptionCode=[15bb6564-00e4d61f], statusCode=403, retryAfter=0, rateLimitStatus=null, version=2.1.6}
03-07 12:48:06.605: W/System.err(1582): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:308)
03-07 12:48:06.605: W/System.err(1582): at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:72)
03-07 12:48:06.605: W/System.err(1582): at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:103)
03-07 12:48:06.605: W/System.err(1582): at twitter4j.Twitter.updateStatus(Twitter.java:500)
03-07 12:48:06.605: W/System.err(1582): at com.twitter.android.TwitterApp.updateStatus(TwitterApp.java:113)
03-07 12:48:06.605: W/System.err(1582): at abhinavasblog.blogspot.com.TwitterForUActivity$1.onComplete(TwitterForUActivity.java:136)
03-07 12:48:06.605: W/System.err(1582): at com.twitter.android.TwitterApp$1.handleMessage(TwitterApp.java:239)
03-07 12:48:06.605: W/System.err(1582): at android.os.Handler.dispatchMessage(Handler.java:99)
03-07 12:48:06.615: W/System.err(1582): at android.os.Looper.loop(Looper.java:130)
03-07 12:48:06.615: W/System.err(1582): at android.app.ActivityThread.main(ActivityThread.java:3694)
03-07 12:48:06.615: W/System.err(1582): at java.lang.reflect.Method.invokeNative(Native Method)
03-07 12:48:06.615: W/System.err(1582): at java.lang.reflect.Method.invoke(Method.java:507)
03-07 12:48:06.615: W/System.err(1582): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
03-07 12:48:06.615: W/System.err(1582): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
03-07 12:48:06.615: W/System.err(1582): at dalvik.system.NativeStart.main(Native Method)
再试一次,又得到如下Exception:
++++++++++++++++++++
03-07 12:49:51.698: W/System.err(1582): java.lang.IllegalStateException: consumer key/secret pair already set.
03-07 12:49:51.708: W/System.err(1582): at twitter4j.TwitterOAuthSupportBaseImpl.setOAuthConsumer(TwitterOAuthSupportBaseImpl.java:234)
03-07 12:49:51.708: W/System.err(1582): at twitter4j.Twitter.setOAuthConsumer(Twitter.java:54)
03-07 12:49:51.708: W/System.err(1582): at com.twitter.android.TwitterApp.configureToken(TwitterApp.java:90)
03-07 12:49:51.708: W/System.err(1582): at com.twitter.android.TwitterApp.access$7(TwitterApp.java:88)
03-07 12:49:51.708: W/System.err(1582): at com.twitter.android.TwitterApp$3.run(TwitterApp.java:164)
03-07 12:49:51.718: E/TWITTER(1582): Error getting access token
查询资料:
http://osdir.com/ml/twitter4j/2010-10/msg00143.html
猜测原因可能是使用了twitter4j-core-2.1.6.jar 这应该是这个版本的一个Bug吧,所以尝试着换个版本试试:
换成最新版本试了一下,发些并不支持老的接口,所以试着换最接近的版本:
你可以从http://twitter4j.org/maven2/org/twitter4j/ 下载得到所有的对应的版本。
最终结果:
这不是我程序的问题,也不是twitter4j的问题,这是twitter安全机制的问题,你可以在Web端试一下,在一段时间内你是不可以重复推送相同内容的推文的。