TwitterAuthException Failed to get request token


I follow Android Twitter Integration from here but seems it’s not working.

I am using Twitter Login from two different activity i.e. MainActivity and ConfigurationActivity but it work on Main Activity but not on configuration Activity.

Here is crash Report which i am getting.

09-24 14:32:26.443  19773-19773/com. E/Twitter﹕ Failed to get request token Unable to resolve host "": No address associated with hostname
        at retrofit.RestAdapter$RestHandler.invokeRequest(
        at retrofit.RestAdapter$RestHandler.access$100(
        at retrofit.RestAdapter$RestHandler$2.obtainResponse(
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$
        at retrofit.Platform$Android$2$
09-24 14:32:26.512  19773-19773/com E/Twitter﹕ Authorization completed with an error Failed to get request token
            at retrofit.CallbackRunnable$
            at android.os.Handler.handleCallback(
            at android.os.Handler.dispatchMessage(
            at android.os.Looper.loop(
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(
    09-24 14:32:26.512  19773-19773/comE/CMDAConfiguration﹕ Twitter Login Exception:- Failed to get request token

I am using auto generated keys using fabric.

Here is MyApplicationClass

public class MyApplication extends Application {
// Note: Your consumer key and secret should be obfuscated in your source code before shipping.
private static final String TWITTER_KEY = xxxxxxxxxxxxxxxxxxxxx";
private static final String TWITTER_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

public void onCreate() {

    TwitterAuthConfig authConfig =
            new TwitterAuthConfig(TWITTER_KEY,

    Fabric.with(this, new Crashlytics(), new Twitter(authConfig));



Here is my Login Integration code from Configuration Activity.

// twitter login button binding
    loginButton = (TwitterLoginButton) findViewById(;

    // Twitter logn button call back
    loginButton.setCallback(new Callback<TwitterSession>() {
        public void success(Result<TwitterSession> result) {
            // getting usre id , access token and secret token from TwitterSession
            String twitter_id = + "";
            String accessToken =;
            String secretToken =;

            Log.i(TAG, "Access Token:- " + accessToken);
            Log.i(TAG, "Secreat Token:- " + secretToken);
            // saving access tokens in sharedPReference
            saveTwitterToken(accessToken, secretToken, twitter_id);

        public void failure(TwitterException exception) {
            Log.e(TAG,"Twitter Login Exception:- "+exception.toString());
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        // Pass the activity result to the login button.
        loginButton.onActivityResult(requestCode, resultCode, data);

I don’t understand why i am getting this exception. Same code i am using for MainActivity but it’s working on MainActivity but not on configuration Activity.