Reputation: 4342
I am trying to add the xml folder and an xml file named file_path.xml to implement the Fileprovider (android). However, when I add the following (Resources/xml/file_path.xml) content the application does not start anymore.
<paths>
<files-path name="files" path="."/>
</paths>
I get a null pointer exception as it cant read these resource. It doesnt matter whether I add the provider tag in manifest or not. I am very new in Xamarin.
Upvotes: 2
Views: 5471
Reputation: 51
Go to the properties of this file, select Build Action "AndroidResource".
In android manifest, inside the tag application, do this:
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>
https://developer.android.com/reference/android/support/v4/content/FileProvider
Upvotes: 5