getting error: "Failed to validate oauth signature and token" in integrating twitter from Android

getting error: "Failed to validate oauth signature and token" in integrating twitter from Android

我正在尝试使用 twitter4j-core 登录 Twitter...我的示例代码如下

@Override
 protected void onCreate(Bundle savedInstanceState) {
  .......
  .....
  ...
  ..
  // Tell twitter4j that we want to use it with our app
  ConfigurationBuilder builder = new ConfigurationBuilder();
  builder.setDebugEnabled(true);
  builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
  builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
  Configuration configuration = builder.build();
  TwitterFactory factory = new TwitterFactory(configuration);
  twitter = factory.getInstance();


  /**
   * Twitter login button click event will call loginToTwitter() function
   * */
  btnTwitterLogoutLogin.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {

    if (isTwitterLoggedInAlready()) {
    logoutFromTwitter();
             } else {
    new LoginNewUser().execute();
    }
  }
 });

}

如果用户未登录并且在单击 btnTwitterLogoutLogin 之后=>

class LoginNewUser extends AsyncTask<Void, Void, Void> {

@Override
protected Void doInBackground(Void... arg0) {
    // TODO Auto-generated method stub

    try {

    requestToken = twitter.getOAuthRequestToken(TWITTER_CALLBACK_URL);
    PostTwitter.this.startActivity(new Intent(Intent.ACTION_VIEW,
                                               Uri.parse(requestToken.getAuthenticationURL())));
    } catch (TwitterException e) {
    e.printStackTrace();
    }
    return null;
}

} 

它显示了一个 webview 登录 activity 并在 onResume 中回调到当前 activity.So 我保存了 accesstoken 和其他东西以保存 session.like 这个:

@Override
protected void onResume() {
   super.onResume();
   Log.i("TAG", "Arrived at onResume");
   dealWithTwitterResponse();
}

private void dealWithTwitterResponse() {
  Uri uri = getIntent().getData();
    if (uri !=null&&uri.toString().startsWith(TWITTER_CALLBACK_URL))                    
      {
          // If the// user// has// just// logged// in
          String oauthVerifier = uri.getQueryParameter("oauth_verifier");
          Log.d("DEBUG", "loggged in");
          new SaveTokenAfterLogin().execute(oauthVerifier);
          // in this method i save accesstoken for further use in sharepreferance 
      }
  else
      {
        Log.d("DEBUG", "Not logged in");
      }
  } 

这段代码可以正常工作几次。但现在它不起作用。显示以下错误:

02-18 07:55:56.885: W/System.err(6659): 401:Authentication credentials  (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure  that   you have set valid consumer key/secret, access token/secret, and the  system clock is in sync.
02-18 07:55:56.885: W/System.err(6659): Failed to validate oauth signature and token
02-18 07:55:56.889: W/System.err(6659): Relevant discussions can be found on the Internet at:
02-18 07:55:56.889: W/System.err(6659):     http://www.google.co.jp/search?q=8e063946 or
02-18 07:55:56.889: W/System.err(6659):     http://www.google.co.jp/search?q=c60cdc4a
02-18 07:55:56.889: W/System.err(6659): TwitterException{exceptionCode=[8e063946-c60cdc4a], statusCode=401, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=4.0.2}
02-18 07:55:56.893: W/System.err(6659):     at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:163)
02-18 07:55:56.893: W/System.err(6659):     at twitter4j.HttpClientBase.request(HttpClientBase.java:53)

我做错了什么?我正在学习本教程 http://blog.blundell-apps.com/sending-a-tweet/

请检查您的 phone 时间设置是否正确。当服务器时间和机器时间不同步时,可能会出现此错误。