Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

MediaPlugin Argument Exception Unable to get file location...

$
0
0

Xamarin Forms app for IOS and Android using MediaPlugin.
Only on some android instances this is not working and throwing the exception below.

The Argument Exeception thrown is:

"Unable to get file location. This most likely means that the file provider information is not set in your Android Manifest file. Please check documentation on how to set this up in your project."

Since AppCenter has no way of reporting handled exceptions properly, i have only an eventtype and no stacktrace, device info or anything, but my guess is it happens after calling
await CrossMedia.Current.TakephotoAsync(...)

The error suggests i have not setup the fileproviders properly, but the fileprovider info is exactly setup as provided in the readme files. It is working on all my Android test devices and emulators.

My file_paths.xml file:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <external-files-path name="my_images" path="Pictures" />
  <external-files-path name="my_movies" path="Movies" />
</paths>

And this is set in the AndroidManifest.xml:

<manifest...>
        <application...>
            <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.myappname.nl.fileprovider" android:exported="false" android:grantUriPermissions="true">
                    <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
                </provider>
        </application>
    </manifest>

What can be wrong on the problematic instances?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>