Android 将文件提供程序添加到清单后,应用程序未启动

Android app does not start when file provider added to manifest

这是我的清单文件

<application>
    <provider
        android:authorities="${applicationId}.fileprovider"
        android:name="android.support.v4.content.FileProvider"
        android:exported="false"
        android:grantUriPermissions="true">
      <meta-data
          android:name="android.support.FILE_PROVIDER_PATHS"
          android:resource="@xml/file_paths" />
    </provider>
  </application>

这是我的file_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths>
  <root-path name="root" path="" />
  <external-path name="external_storage_root" path="." />
  <external-path name="external_storage_download" path="Download" />
</paths>

当我尝试执行我的应用程序时,出现以下错误

Error failed processing manifest. Error resource xml/file_paths (aka com.companyname.ProjectName:xml/file_paths) not found.

This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file. Project Name C:..\source\repos\ProjectName\Properties\AndroidManifest.xml

我搜索了 google 并尝试了很多解决方案,但没有一个真正有效所以我现在在这里,希望有人能帮助我。

您是否在 Resources 文件夹中创建了名为 xml 的文件夹?

如下所示: