5

I have a Google+ connection in my app, and when I try to get the user's information with a Person Object, everything works just fine.

but when I'm using the Share dialog as stated in the documentation, I get a crash in the G+ library.

here is the code I'm using for this:

Intent shareIntent = new PlusShare.Builder(getActivity())
                .setType("text/plain")
                .setText(getString(R.string.application_sharing_default_share_with_friends))
                .setContentUrl(Uri.parse(shareLink))
                .getIntent();
startActivityForResult(shareIntent, 0);

and when I run this all I get is this error and crash:

11-05 11:30:51.093: E/AndroidRuntime(617): FATAL EXCEPTION: main
11-05 11:30:51.093: E/AndroidRuntime(617): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.apps.plus/com.google.android.apps.plus.phone.ShareActivity}: java.lang.IllegalStateException: Activity started without an EXTRA_ACCOUNT
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.os.Looper.loop(Looper.java:137)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.ActivityThread.main(ActivityThread.java:4745)
11-05 11:30:51.093: E/AndroidRuntime(617):  at java.lang.reflect.Method.invokeNative(Native Method)
11-05 11:30:51.093: E/AndroidRuntime(617):  at java.lang.reflect.Method.invoke(Method.java:511)
11-05 11:30:51.093: E/AndroidRuntime(617):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-05 11:30:51.093: E/AndroidRuntime(617):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-05 11:30:51.093: E/AndroidRuntime(617):  at dalvik.system.NativeStart.main(Native Method)
11-05 11:30:51.093: E/AndroidRuntime(617): Caused by: java.lang.IllegalStateException: Activity started without an EXTRA_ACCOUNT
11-05 11:30:51.093: E/AndroidRuntime(617):  at brz.onCreate(PG:169)
11-05 11:30:51.093: E/AndroidRuntime(617):  at com.google.android.apps.plus.phone.PostActivity.onCreate(PG:77)
11-05 11:30:51.093: E/AndroidRuntime(617):  at com.google.android.apps.plus.phone.ShareActivity.onCreate(PG:156)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.Activity.performCreate(Activity.java:5008)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-05 11:30:51.093: E/AndroidRuntime(617):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-05 11:30:51.093: E/AndroidRuntime(617):  ... 11 more
thepoosh
  • 12,497
  • 15
  • 73
  • 132

2 Answers2

1

This was a bug in the Google+ app that is fixed in the latest build that came out today: https://plus.google.com/101870761930221849874/posts/KohXe9pBGF6 Sorry about that.

ade
  • 4,056
  • 1
  • 20
  • 25
0

Check your g+ app first, it is likely the g+ account is not completely set up. Go to the g+ and follow the steps to have at least one g+ account set up and the error should be gone.

Wei Xiao
  • 3
  • 1
  • you're wrong, when that is the case, there is a connection error, not a crash in the G+ app – thepoosh Dec 11 '13 at 07:49
  • @thepoosh are you able to find reason of error. I am getting similar error in my app. – anujprashar Dec 11 '13 at 10:02
  • @anujprashar - the only reason I can think of is having different code bases for the play-services app or google+ app that causes this crash – thepoosh Dec 11 '13 at 10:05
  • @thepoosh not necessarily. In my case, I had this error. I didnt not touch any code or my app but have the account set up completely and the error was gone. I have a try catch (with Exception e) surrounded the intent launch code but it never caught this exception. I am suspecting the exception was thrown by g+ after it was launched. I am also looking for a way in the code to check if the account was functional before launching the intent. – Wei Xiao Dec 11 '13 at 17:41