plugin.media error

Posted on

Question :

I’m trying to use the Media Plugin for Xamarin and Windows with the Visual Studio Community 2017 . An android app that should have the ability to take some photos.

I followed the following guidelines:

In Resources, you added a folder named 'xml' and inside it I created a file by name file_paths.xml with the following code:

 <?xml version="1.0" encoding="utf-8"?>
    <paths xmlns_android="http://schemas.android.com/apk/res/android">
      <files-path name="my_images" path="images/"/>
      <files-path name="my_docs" path="docs/"/>
    </paths>

Then I opened the file AndroidManifest.xml and added the following code:

<application android_label="ReporOnLine.Android">
    <provider
        android_name="android.support.v4.content.FileProvider"
        android_authorities="${applicationId}.fileprovider"
        android_exported="false"
        android_grantUriPermissions="true">
      <meta-data
          android_name="android.support.FILE_PROVIDER_PATHS"
          android_resource="@xml/file_paths" />
    </provider>     
    </application>

In the AssemblyInfo.cs file I added:

[assembly: UsesFeature("android.hardware.camera", Required = false)]
[assembly: UsesFeature("android.hardware.camera.autofocus", Required = false)]

When I try to debug the application using Genymotion with Google Nexus 4 – 5.0.0 API 21 , or less on my smartphone, it generates the error as attached image.

Thank you if anyone can help me.

    

Answer :

Replace the following line:

android:authorities="${applicationId}.fileprovider" 

by

android:authorities="com.companyname.ReporOnLine.fileprovider"

I cleaned the solution and recompiled, everything worked perfectly.

    

Leave a Reply

Your email address will not be published. Required fields are marked *