google+ 的 ActivityNotFoundException

ActivityNotFoundException with google+

我正在尝试按照 google tutorial 分享图片,但一直收到此异常:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND typ=jpg flg=0x80000 pkg=com.google.android.apps.plus (has extras) }
            at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1601)
            at android.app.Instrumentation.execStartActivity(Instrumentation.java:1465)
            at android.app.Activity.startActivityForResult(Activity.java:3190)
            at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:820)

有什么想法吗?

当您设置 photoPicker.setType("video/*, image/*") 时,这意味着所有 returned 图像都应具有 video/*image/* 的 MIME 类型,但看起来您只收到 jpg。调用照片选择器应更改为 return 适当的 MIME 类型 - 在本例中为 image/jpg.

请注意 FileProvider can be used to easily create shareable links to files to send to other apps (appropriate for setStream()) as per the setting up file sharing training - 它会自动为您处理 MIME 类型。