I was developing an app for google service text detection, and encounter a problem for sharing files using 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>
For res/xml/provider_paths.xml:
<paths>
<files-path path="images/" name="myimages" />
<external-path name="download" path="download/"/>
</paths>
However I always get this compilation error:
Error:No resource found that matches the given name (at 'resource' with value '@xml/provider_paths').
What went wrong?
I just spent ages on the same issue. Some people suggested typos (no typos there) some mentioned other possibilities like wrong folder or advising techniques of modifying config.xml or checking sdk versions.... The thing that was missing for me was that the "provider_paths.xml" Build Action was set to Content and not to AndroidResource hence it was never copied during compilation hence it was missing and never found... I think this is the same issue here.