Android 发送带有多个附件的电子邮件:“;openFileDescriptor时出现安全异常";(GMail)

Android 发送带有多个附件的电子邮件:“;openFileDescriptor时出现安全异常";(GMail),android,permissions,email-attachments,Android,Permissions,Email Attachments,要发送多个附件,我使用以下代码创建邮件意图: private Intent buildIntent(FotoBatch fotos) { Intent email = new Intent(Intent.ACTION_SEND_MULTIPLE); email.addFlags(FLAG_GRANT_READ_URI_PERMISSION); email.setType("message/rfc822"); email.putExtra(Intent.EX

要发送多个附件,我使用以下代码创建邮件意图:

 private Intent buildIntent(FotoBatch fotos) {
    Intent email = new Intent(Intent.ACTION_SEND_MULTIPLE);

    email.addFlags(FLAG_GRANT_READ_URI_PERMISSION);


    email.setType("message/rfc822");
    email.putExtra(Intent.EXTRA_EMAIL, new String[]{MAIL_RECIPIENT});

    ...

    // Attachments
    ArrayList<Uri> uris = new ArrayList<>();
    for (Foto foto : fotos.getFotos()) {
        uris.add(foto.getUri());
    }
    email.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

    return email;
}
K9邮件:

 Caused by: java.lang.SecurityException: Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{a320841 7869:com.fsck.k9/u0a195} (pid=7869, uid=10195) that is not exported from UID 10196
    at android.os.Parcel.readException(Parcel.java:1943)
清单包含提供程序条目

<provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.timeshuttle.lagerapp.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths" />
</provider>

文件_paths.xml的内容:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path name="my_images" path="Android/data/com.timeshuttle.lagerapp/files/Pictures" />
</paths>

内容提供商配置中缺少什么

在安卓8.0设备上测试了安卓API级别27

如果附件列表仅包含一项,则不会出错。邮件应用程序将打开并正确显示附件(图像)

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path name="my_images" path="Android/data/com.timeshuttle.lagerapp/files/Pictures" />
</paths>