Android com.twitter.sdk.android:twitter:3.1.1 throwing errors

android
oauth
api

#1

I have followed the instrutions that are specified in docs for login Autentication.

Attaching the errors.
E/Twitter: Invalid json: <?xml version="1.0" encoding="UTF-8"?>

Desktop applications only support the oauth_callback value ‘oob’
/oauth/request_token

                                                                 com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
                                                                     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
                                                                     at com.twitter.sdk.android.core.models.SafeListAdapter$1.read(SafeListAdapter.java:45)
                                                                     at com.twitter.sdk.android.core.models.SafeMapAdapter$1.read(SafeMapAdapter.java:45)
                                                                     at com.google.gson.Gson.fromJson(Gson.java:887)
                                                                     at com.google.gson.Gson.fromJson(Gson.java:852)
                                                                     at com.google.gson.Gson.fromJson(Gson.java:801)
                                                                     at com.google.gson.Gson.fromJson(Gson.java:773)
                                                                     at com.twitter.sdk.android.core.TwitterApiException.parseApiError(TwitterApiException.java:110)
                                                                     at com.twitter.sdk.android.core.TwitterApiException.readApiError(TwitterApiException.java:95)
                                                                     at com.twitter.sdk.android.core.TwitterApiException.<init>(TwitterApiException.java:43)
                                                                     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:148)
                                                                     at android.app.ActivityThread.main(ActivityThread.java:5539)
                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                  Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
                                                                     at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
                                                                     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
                                                                     at com.twitter.sdk.android.core.models.SafeListAdapter$1.read(SafeListAdapter.java:45) 
                                                                     at com.twitter.sdk.android.core.models.SafeMapAdapter$1.read(SafeMapAdapter.java:45) 
                                                                     at com.google.gson.Gson.fromJson(Gson.java:887) 
                                                                     at com.google.gson.Gson.fromJson(Gson.java:852) 
                                                                     at com.google.gson.Gson.fromJson(Gson.java:801) 
                                                                     at com.google.gson.Gson.fromJson(Gson.java:773) 
                                                                     at com.twitter.sdk.android.core.TwitterApiException.parseApiError(TwitterApiException.java:110) 
                                                                     at com.twitter.sdk.android.core.TwitterApiException.readApiError(TwitterApiException.java:95) 
                                                                     at com.twitter.sdk.android.core.TwitterApiException.<init>(TwitterApiException.java:43) 
                                                                     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:148) 
                                                                     at android.app.ActivityThread.main(ActivityThread.java:5539) 
                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

10-07 00:59:45.970 8955-8955/app.sai.com.twittersampleapp E/Twitter: Failed to get request token
com.twitter.sdk.android.core.TwitterApiException: HTTP request failed, Status: 401
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:148)
at android.app.ActivityThread.main(ActivityThread.java:5539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-07 00:59:45.982 8955-8955/app.sai.com.twittersampleapp D/AppTracker: App Event: stop
10-07 00:59:46.001 8955-8955/app.sai.com.twittersampleapp E/Twitter: Authorization completed with an error
com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:94)
at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:191)
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:148)
at android.app.ActivityThread.main(ActivityThread.java:5539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)