Reputation: 7893
I rerally didn't want to ask this question, but I couldn't find any solutions.
In my manifest I have declared FileProvider:
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
It requires @xml/provider_paths
to work. In my resources folder I have created provider_paths.xml
file and copy-pasted this code:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="files" path="."/>
</paths>
However Android Studio IDE throws me that kind of error:
Element paths must be declared
My screenshot:
Upvotes: 2
Views: 2807
Reputation: 13358
Move the provider_path.xml from values directory to res/xml/provider_paths.xml
To specify the directories, start by creating the file filepaths.xml in the res/xml/ subdirectory of your project. In this file, specify the directories by adding an XML element for each directory.
Refer Specify Sharable Directories
Upvotes: 5