Unity SDK: Login doesn't work on android app if twitter app is not installed

unity

#1

Hi there

Login doesn’t work on android app if twitter app is not installed. It shows a loader for few seconds and then goes back to app. What could be the issue? I guess its trying to load Web View but fails.

I tested it on 3 android devices and same result when no twitter app is installed.

Thanks


#2

Hey @ARafay,

Could you share the Logcat output when this occurs and which version of Twitter Kit you’re using?

-Mike


#3

Hey @ARafay,

Unable to reproduce, we are able to login within web view without Twitter App installed. Can you possibly share your code and logcat?

Additional docs can be found here: https://docs.fabric.io/unity/twitter/log-in-with-twitter.html


#4

Can you please suggest a free logcat reader?
Thanks


#5

Hey @ARafay,

If you connect your device to Android Studio, you’ll see the Logcat output within that.

-Mike


#6

Hey @ARafay,

You can also output the logs to console using Android debug bridge:
‘adb logcat’
‘adb --help’


#7

Hi guys, i’m getting the same error.

Here’s the logcat

11-21 07:36:21.557: E/Twitter(1737): Invalid json: <?xml version="1.0" encoding="UTF-8"?>
11-21 07:36:21.557: E/Twitter(1737): <hash>
11-21 07:36:21.557: E/Twitter(1737):   <error>Desktop applications only support the oauth_callback value 'oob'</error>
11-21 07:36:21.557: E/Twitter(1737):   <request>/oauth/request_token</request>
11-21 07:36:21.557: E/Twitter(1737): </hash>
11-21 07:36:21.557: E/Twitter(1737): com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
11-21 07:36:21.557: E/Twitter(1737): 	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
11-21 07:36:21.557: E/Twitter(1737): 	at com.google.gson.Gson.fromJson(Gson.java:879)
11-21 07:36:21.557: E/Twitter(1737): 	at com.google.gson.Gson.fromJson(Gson.java:844)
11-21 07:36:21.557: E/Twitter(1737): 	at com.google.gson.Gson.fromJson(Gson.java:793)
11-21 07:36:21.557: E/Twitter(1737): 	at com.google.gson.Gson.fromJson(Gson.java:765)
11-21 07:36:21.557: E/Twitter(1737): 	at com.twitter.sdk.android.core.TwitterApiException.parseApiError(TwitterApiException.java:105)
11-21 07:36:21.557: E/Twitter(1737): 	at com.twitter.sdk.android.core.TwitterApiException.readApiError(TwitterApiException.java:93)
11-21 07:36:21.557: E/Twitter(1737): 	at com.twitter.sdk.android.core.TwitterApiException.<init>(TwitterApiException.java:41)
11-21 07:36:21.557: E/Twitter(1737): 	at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
11-21 07:36:21.557: E/Twitter(1737): 	at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
11-21 07:36:21.557: E/Twitter(1737): 	at android.os.Handler.handleCallback(Handler.java:733)
11-21 07:36:21.557: E/Twitter(1737): 	at android.os.Handler.dispatchMessage(Handler.java:95)
11-21 07:36:21.557: E/Twitter(1737): 	at android.os.Looper.loop(Looper.java:136)
11-21 07:36:21.557: E/Twitter(1737): 	at android.app.ActivityThread.main(ActivityThread.java:5001)
11-21 07:36:21.557: E/Twitter(1737): 	at java.lang.reflect.Method.invokeNative(Native Method)
11-21 07:36:21.557: E/Twitter(1737): 	at java.lang.reflect.Method.invoke(Method.java:515)
11-21 07:36:21.557: E/Twitter(1737): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-21 07:36:21.557: E/Twitter(1737): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-21 07:36:21.557: E/Twitter(1737): 	at dalvik.system.NativeStart.main(Native Method)
11-21 07:36:21.557: E/Twitter(1737): Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
11-21 07:36:21.557: E/Twitter(1737): 	at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:387)
11-21 07:36:21.557: E/Twitter(1737): 	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:209)
11-21 07:36:21.557: E/Twitter(1737): 	... 18 more
11-21 07:36:21.561: E/Twitter(1737): Failed to get request token
11-21 07:36:21.561: E/Twitter(1737): com.twitter.sdk.android.core.TwitterApiException: HTTP request failed, Status: 401
11-21 07:36:21.561: E/Twitter(1737): 	at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
11-21 07:36:21.561: E/Twitter(1737): 	at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
11-21 07:36:21.561: E/Twitter(1737): 	at android.os.Handler.handleCallback(Handler.java:733)
11-21 07:36:21.561: E/Twitter(1737): 	at android.os.Handler.dispatchMessage(Handler.java:95)
11-21 07:36:21.561: E/Twitter(1737): 	at android.os.Looper.loop(Looper.java:136)
11-21 07:36:21.561: E/Twitter(1737): 	at android.app.ActivityThread.main(ActivityThread.java:5001)
11-21 07:36:21.561: E/Twitter(1737): 	at java.lang.reflect.Method.invokeNative(Native Method)
11-21 07:36:21.561: E/Twitter(1737): 	at java.lang.reflect.Method.invoke(Method.java:515)
11-21 07:36:21.561: E/Twitter(1737): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-21 07:36:21.561: E/Twitter(1737): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-21 07:36:21.561: E/Twitter(1737): 	at dalvik.system.NativeStart.main(Native Method)
11-21 07:36:21.577: I/Finsky(663): [50] com.google.android.finsky.c.e.run(1152): Replicating app states via AMAS.
11-21 07:36:21.581: I/android_os_LeapdroidJNI(475): Leapdroid_set()
11-21 07:36:21.581: I/android_os_LeapdroidJNI(475): Leapdroid_set(): setPropVBox(key=android_launched_package, val=com.Vivelab.Reconstruccion), err=0
11-21 07:36:21.581: W/ActivityManager(475): resume package=com.Vivelab.Reconstruccion
11-21 07:36:21.601: E/Twitter(1737): Authorization completed with an error
11-21 07:36:21.601: E/Twitter(1737): com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
11-21 07:36:21.601: E/Twitter(1737): 	at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:95)
11-21 07:36:21.601: E/Twitter(1737): 	at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:194)
11-21 07:36:21.601: E/Twitter(1737): 	at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
11-21 07:36:21.601: E/Twitter(1737): 	at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
11-21 07:36:21.601: E/Twitter(1737): 	at android.os.Handler.handleCallback(Handler.java:733)
11-21 07:36:21.601: E/Twitter(1737): 	at android.os.Handler.dispatchMessage(Handler.java:95)
11-21 07:36:21.601: E/Twitter(1737): 	at android.os.Looper.loop(Looper.java:136)
11-21 07:36:21.601: E/Twitter(1737): 	at android.app.ActivityThread.main(ActivityThread.java:5001)
11-21 07:36:21.601: E/Twitter(1737): 	at java.lang.reflect.Method.invokeNative(Native Method)
11-21 07:36:21.601: E/Twitter(1737): 	at java.lang.reflect.Method.invoke(Method.java:515)
11-21 07:36:21.601: E/Twitter(1737): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-21 07:36:21.601: E/Twitter(1737): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-21 07:36:21.601: E/Twitter(1737): 	at dalvik.system.NativeStart.main(Native Method)

#8

Forget it, I only needed to fill up the “Callback URL” field in the Twitter settings dev account.

:see_no_evil::slight_smile:


#9