Twitter app crash on non-logged in tweet

android

#1

“Twitter has stopped” appears if I am trying to send a tweet via https://docs.fabric.io/android/twitter/compose-tweets.html#set-up-kit or simply through an intent (while Twitter app is installed, but user hasn’t logged in).

If twitter app isn’t installed it would open up browser to tweet and log in.


#2

@azemar can you let me know what version of Twitter you’re running?


#3

Latest one, 6.31.0
Phone tested on: nexus 6p Android 7.0 Rooted


#4

Thanks @azemar. Have you tested it on another device using the same version of Twitter?


#5

@alexsinger Sure, tested it on couple more: Samsung SM-J100H 4.4.4 and Lenovo Tab 2 A10-70L 5.0.1


#6

Can you share the code you’re using to compose the tweet and also let me know what version of Twitter Kit you’re running?


#7

Basically an example code from https://docs.fabric.io/android/twitter/compose-tweets.html#set-up-kit

dependencies {
    compile('com.twitter.sdk.android:tweet-composer:2.3.1@aar') {
        transitive = true;
    }
}
...
 TwitterAuthConfig authConfig = new TwitterAuthConfig(key, secret);
 TwitterCore core = new TwitterCore(authConfig);
 Fabric.with(this, core, new TweetComposer());
 TweetComposer.Builder builder = new TweetComposer.Builder(MainActivity.this).text("heh");
 builder.show();

#8

@azemar thanks for the details. I just tried your code in my sample project and wasn’t able to repro the crash. I’m using 6.32.0 of the Twitter app. Do you have a sample project you can zip and share with me via a link?


#9

@alexsinger Obviously changed key and secret values to “key”, “secret”. https://www.dropbox.com/s/o6g7acoofovrarc/MyApplication.rar?dl=0


#10

I still haven’t been able to reproduce the crash on my Galaxy S6. I switched the gradle version to 2.2.3 instead of 2.3.0-beta3 because my version of Android Studio isn’t compatible with 2.3.0-beta3. Can you try using gradle 2.2.3?


#11

Tried with 2.2.3 same crash, to be fair it’s not just kit, I’ve tried few ways to tweet via android intents alone and that crashes twittter app as well (only if logged out).


#12

Via composer:

FATAL EXCEPTION: main
    Process: com.twitter.android, PID: 17629
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.twitter.android/com.twitter.android.composer.ComposerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.twitter.android.composer.geotag.a.a(boolean, int)' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.twitter.android.composer.geotag.a.a(boolean, int)' on a null object reference
    at com.twitter.android.composer.ComposerActivity.d(Twttr:1696)
    at com.twitter.android.composer.ComposerActivity.finish(Twttr:1715)
    at com.twitter.android.DispatchActivity.a(Twttr:83)
    at com.twitter.app.common.base.TwitterFragmentActivity.l_(Twttr:681)
    at com.twitter.app.common.abs.AbsFragmentActivity.onCreate(Twttr:171)
    at com.twitter.app.common.base.TwitterFragmentActivity.onCreate(Twttr:189)
    at android.app.Activity.performCreate(Activity.java:6664)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
    at android.app.ActivityThread.-wrap12(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:154) 
    at android.app.ActivityThread.main(ActivityThread.java:6077) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 

Via intent:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.twitter.android/com.twitter.android.composer.ComposerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.twitter.android.composer.j.a(boolean, int)' on a null object reference


#13

I was just able to repro this. Being logged out was the key part. I’ll raise this up to the Twitter for Android team so that it’s on their radar. Thanks for all the details and helping me reproduce it!