Gmail crashes when 'am start -a android.intent.action.SEND' with EXTRA_STREAM

981 views
Skip to first unread message

John Michelau

unread,
Mar 11, 2010, 4:53:53 PM3/11/10
to android-platform
I'm not sure what I'm missing. Gmail can't seem to understand the URI
string that I'm sending.

am start -D -a android.intent.action.SEND -t "image/jpeg" -e
"android.intent.extra.STREAM" "file://sdcard/download/
downloadfile-1.jpeg"
Starting: Intent { act=android.intent.action.SEND typ=image/jpeg (has
extras) }

After issuing the command, the chooser comes up and I select GMail.
When I select GMail, it gets a Force Close. Here's the relevant log
statements (AFAIK).

03-11 15:45:37.224 I/ActivityManager( 1014): Starting activity: Intent
{ act=android.intent.action.SEND typ=image/jpeg flg=0x10000000
cmp=android/com.android.internal.app.ResolverActivity (has extras) }
03-11 15:45:37.716 I/ActivityManager( 1014): Displayed activity
android/com.android.internal.app.ResolverActivity: 481 ms (total 481
ms)
03-11 15:45:43.709 I/ActivityManager( 1014): Starting activity: Intent
{ act=android.intent.action.SEND typ=image/jpeg flg=0x13800000
cmp=com.google.android.gm/.ComposeActivityGmail (has extras) }
03-11 15:45:43.732 I/ActivityManager( 1014): Starting activity: Intent
{ act=android.intent.action.SEND typ=image/jpeg flg=0x2800000
cmp=com.google.android.gm/.ComposeActivity (has extras) }
03-11 15:45:43.904 D/dalvikvm(21004): GC freed 1261 objects / 73576
bytes in 51ms
03-11 15:45:43.990 W/Bundle (21004): Key android.intent.extra.STREAM
expected Parcelable but value was a java.lang.String. The default
value <null> was returned.
03-11 15:45:43.998 W/Bundle (21004): Attempt to cast generated
internal exception:
03-11 15:45:43.998 W/Bundle (21004): java.lang.ClassCastException:
java.lang.String
03-11 15:45:43.998 W/Bundle (21004): at
android.os.Bundle.getParcelable(Bundle.java:1043)
03-11 15:45:43.998 W/Bundle (21004): at
com.google.android.gm.ComposeActivity.initFromExtras(ComposeActivity.java:
871)
03-11 15:45:43.998 W/Bundle (21004): at
com.google.android.gm.ComposeActivity.finishOnCreateAfterAccountSelected(ComposeActivity.java:
1154)
03-11 15:45:43.998 W/Bundle (21004): at
com.google.android.gm.ComposeActivity.onCreate(ComposeActivity.java:
332)
03-11 15:45:43.998 W/Bundle (21004): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
03-11 15:45:43.998 W/Bundle (21004): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2459)
03-11 15:45:43.998 W/Bundle (21004): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2512)
03-11 15:45:43.998 W/Bundle (21004): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-11 15:45:43.998 W/Bundle (21004): at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:1863)
03-11 15:45:43.998 W/Bundle (21004): at
android.os.Handler.dispatchMessage(Handler.java:99)
03-11 15:45:43.998 W/Bundle (21004): at
android.os.Looper.loop(Looper.java:123)
03-11 15:45:43.998 W/Bundle (21004): at
android.app.ActivityThread.main(ActivityThread.java:4363)
03-11 15:45:43.998 W/Bundle (21004): at
java.lang.reflect.Method.invokeNative(Native Method)
03-11 15:45:43.998 W/Bundle (21004): at
java.lang.reflect.Method.invoke(Method.java:521)
03-11 15:45:43.998 W/Bundle (21004): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-11 15:45:43.998 W/Bundle (21004): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-11 15:45:43.998 W/Bundle (21004): at
dalvik.system.NativeStart.main(Native Method)
03-11 15:45:43.998 D/AndroidRuntime(21004): Shutting down VM
03-11 15:45:43.998 W/dalvikvm(21004): threadid=3: thread exiting with
uncaught exception (group=0x4001b190)
03-11 15:45:43.998 E/AndroidRuntime(21004): Uncaught handler: thread
main exiting due to uncaught exception
03-11 15:45:44.005 E/AndroidRuntime(21004):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.google.android.gm/
com.google.android.gm.ComposeActivity}: java.lang.NullPointerException
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2496)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2512)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.os.Handler.dispatchMessage(Handler.java:99)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.os.Looper.loop(Looper.java:123)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.app.ActivityThread.main(ActivityThread.java:4363)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
java.lang.reflect.Method.invokeNative(Native Method)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
java.lang.reflect.Method.invoke(Method.java:521)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
dalvik.system.NativeStart.main(Native Method)
03-11 15:45:44.005 E/AndroidRuntime(21004): Caused by:
java.lang.NullPointerException
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.provider.Gmail$AttachmentOrigin.localFileExtras(Gmail.java:
1710)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
com.google.android.gm.ComposeActivity.addAttachment(ComposeActivity.java:
521)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
com.google.android.gm.ComposeActivity.initFromExtras(ComposeActivity.java:
872)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
com.google.android.gm.ComposeActivity.finishOnCreateAfterAccountSelected(ComposeActivity.java:
1154)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
com.google.android.gm.ComposeActivity.onCreate(ComposeActivity.java:
332)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
03-11 15:45:44.005 E/AndroidRuntime(21004): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2459)
03-11 15:45:44.005 E/AndroidRuntime(21004): ... 11 more
03-11 15:45:44.013 I/Process ( 1014): Sending signal. PID: 21004 SIG:
3
03-11 15:45:44.013 I/dalvikvm(21004): threadid=7: reacting to signal 3
03-11 15:45:44.021 I/dalvikvm(21004): Wrote stack trace to '/data/anr/
traces.txt'
03-11 15:45:44.177 I/DumpStateReceiver( 1014): Added state dump to 1
crashes

Dianne Hackborn

unread,
Mar 11, 2010, 5:08:13 PM3/11/10
to android-...@googlegroups.com
You are giving a string for the STREAM parameter, but this should be a Uri.  There is no facility with the am command to create a Uri argument.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

John Michelau

unread,
Mar 11, 2010, 5:20:08 PM3/11/10
to android-platform
I'm trying to extend the adb bugreport capability in our device so
that it pops up the Gmail Composer with the bugreport attached when
the user presses the special key-sequence (Left Shift + Menu) to
generate the bugreport to the sdcard.

Perhaps I could write a simple app that handles a custom intent and
essentially forwards it as the SEND intent with a proper URI based on
the string received?

> > android-platfo...@googlegroups.com<android-platform%2Bunsu...@googlegroups.com>


> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer

> hack...@android.com

Dianne Hackborn

unread,
Mar 11, 2010, 11:58:52 PM3/11/10
to android-...@googlegroups.com
Sure, you could write an app to do that.

To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer

Maulik Dadhaniya

unread,
Oct 14, 2017, 2:00:04 PM10/14/17
to android-platform
Put your Code into try catch block
Reply all
Reply to author
Forward
0 new messages