在twitter登录时出现此异常com.twitter.sdk.android.core.TwitterApiException:HTTP请求失败,状态:401如何解决此问题?

在twitter登录时出现此异常com.twitter.sdk.android.core.TwitterApiException:HTTP请求失败,状态:401如何解决此问题?,android,twitter-bootstrap,android-studio,twitter,twitter-oauth,Android,Twitter Bootstrap,Android Studio,Twitter,Twitter Oauth,我的Twitter集成类如下: public class LandingActivity extends BaseActivity { private static final String TWITTER_KEY = "b8X3lN6EbpHwnHROrObIEeMRW"; private static final String TWITTER_SECRET = "ezJAykSFBLlwPPaFk7Dfj5KWB6ioSZgMFyW0f3ViqqtYD0Hcod";

我的Twitter集成类如下:

public class LandingActivity extends BaseActivity {

    private static final String TWITTER_KEY = "b8X3lN6EbpHwnHROrObIEeMRW";
    private static final String TWITTER_SECRET = "ezJAykSFBLlwPPaFk7Dfj5KWB6ioSZgMFyW0f3ViqqtYD0Hcod";

    //Tags to send the username and image url to next activity using intent
    public static final String KEY_USERNAME = "username";
    public static final String KEY_PROFILE_IMAGE_URL = "image_url";

    //Twitter Login Button
    TwitterLoginButton twitterLoginButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
        Fabric.with(this, new Twitter(authConfig));
        setContentView(R.layout.activity_landing);
        applyFonts();
        findViewById(R.id.btn_login).setOnClickListener(this);
        findViewById(R.id.btn_register).setOnClickListener(this);

        twitterLoginButton = (TwitterLoginButton) findViewById(R.id.twitterLogin);

        //Adding callback to the button
        twitterLoginButton.setCallback(new Callback < TwitterSession > () {

            @Override
            public void success(Result < TwitterSession > result) {
                login(result);
            }

            @Override
            public void failure(TwitterException exception) {
                Log.e("TwitterKit", "Login with Twitter failure", exception);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        twitterLoginButton.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_login:
                startActivity(new Intent(getApplicationContext(), LoginActivity.class));
                break;
            case R.id.btn_register:
                startActivity(new Intent(getApplicationContext(), RegistrationActivity.class));
                break;
        }
    }

    private void applyFonts() {
        Utils.setTypeface(this, (TextView) findViewById(R.id.btn_login), Config.CENTURY_GOTHIC_REGULAR);
        Utils.setTypeface(this, (TextView) findViewById(R.id.btn_register), Config.CENTURY_GOTHIC_REGULAR);

    }
    public void login(Result < TwitterSession > result) {

        //Creating a twitter session with result's data
        TwitterSession session = result.data;

        //Getting the username from session
        final String username = session.getUserName();

        //This code will fetch the profile image URL
        //Getting the account service of the user logged in
        Call < User > call = Twitter.getApiClient(session).getAccountService()
            .verifyCredentials(true, false);
        call.enqueue(new Callback < User > () {
            @Override
            public void failure(TwitterException e) {
                //If any error occurs handle it here
            }
            @Override
            public void success(Result < User > userResult) {
                //If it succeeds creating a User object from userResult.data
                User user = userResult.data;
                String twitterImage = user.profileImageUrl;

                try {
                    Log.e("imageurl", user.profileImageUrl);
                    Log.e("name", user.name);
                    Log.e("email", user.email);
                    Log.e("des", user.description);
                    Log.e("followers ", String.valueOf(user.followersCount));
                    Log.e("createdAt", user.createdAt);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

}
com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
    at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:95)
    at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:194)
    at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
    at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5276)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)