Xamarin Android FileProvider Java.Lang.IllegalArgumentException: 找不到配置的根包含

Xamarin Android FileProvider Java.Lang.IllegalArgumentException: Failed to find configured root that contains

我使用 Xamarin 创建 Android 应用程序。我想在其他应用程序中打开我的应用程序文件(比如 .docx 文件在 Microsoft Word 应用程序等中)。 我使用 FileProvider,但总是出现此错误:

Exception:Java.Lang.IllegalArgumentException: Failed to find configured root that contains...

这是我的 FileProvider 文件:

[Android.App.MetaData("android.support.FILE_PROVIDER_PATHS", Resource = "@xml/file_provider_path")]
[Android.Content.ContentProvider(new System.String[] { "${applicationId}.fileProvider" }, Exported = false, GrantUriPermissions = true, Name = "Android.Support.V4.Content.FileProvider")]
public  class AppFileProvider : Android.Support.V4.Content.FileProvider
{
    public AppFileProvider()
    {

    }

}

我还有 .xml 文件,名称为 file_provider_path.xml,内容为:

<?xml version="1.0" encoding="UTF-8" ?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <files-path name="file_provider_path" path="/" />
</paths>

并获取我使用的文件 uri:

Java.IO.File _file = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory, "document1.docx");
AppFileProvider.GetUriForFile(this.ApplicationContext, this.Application.ApplicationContext.PackageName + ".fileProvider", _file)

你能帮我找到解决办法吗?

根据 Mike 的评论,我阅读了这篇文章 https://developer.android.com/reference/android/support/v4/content/FileProvider#SpecifyFiles。 我需要在 file_provider_path.xml 中设置“../”作为我的路径,因为我没有将文件保存在文件夹中。