android - 错误 :No resource found that matches the given name (at 'resource' with value '@xml/provider_paths' )

标签 android google-api android-fileprovider

我正在开发一个用于谷歌服务文本检测的应用程序,遇到使用 File_PROVIDER 共享文件的问题。

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="myPackageFoo">

<uses-feature android:name="android.hardware.camera" />

<uses-permission android:name="android.permission.CAMERA" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
    <meta-data
            android:name="com.google.android.nearby.messages.API_KEY"
            android:value="@string/API_KEY" />
    <meta-data
            android:name="com.google.android.gms.vision.DEPENDENCIES"
            android:value="ocr" />
    <activity android:name=".MainActivity" android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="myPackageFoo.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
        <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
    </provider>
</application>

对于 res/xml/provider_paths.xml:

<paths>
<files-path path="images/" name="myimages" />
<external-path name="download" path="download/"/>
</paths>

但是我总是得到这个编译错误:

错误:找不到与给定名称匹配的资源(在值为“@xml/provider_paths”的“资源”处)。

出了什么问题?

最佳答案

我只是在同一个问题上花了很长时间。 有些人建议拼写错误(那里没有拼写错误)有些人提到了其他可能性,例如错误的文件夹或修改 config.xml 或检查 sdk 版本的建议技术.... 我缺少的是“provider_paths.xml”Build Action 设置为 Content 而不是 AndroidResource 因此它在编译期间从未被复制因此它丢失并且从未找到...... 我认为这是同一个问题。

关于android - 错误 :No resource found that matches the given name (at 'resource' with value '@xml/provider_paths' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49684685/

相关文章:

android - 条件 XML 编辑文本格式

c# - 如何在Unity中从Uri.fromfile转换为FileProvider.getUriForFile?

google-api - 在公共(public)模式下访问 Google+ (Ruby) API

javascript - 谷歌地图中显示的建筑物没有纹理

android - FileProvider NPE 空对象引用

java - 如何使用Retrofit2在Listview中显示json数据

android - 配置 OpenCV 时出错。当我运行该应用程序时,它显示我有 cpp 文件,但它们没有使用受支持的 native 构建系统

iOS 中的 Android 基本名称值对列表

google-apps-script - 我可以将项目添加到我的附加组件的 Google 文档右键菜单中吗?