简体   繁体   English

Xamarin.Android 中的文件提供程序异常

[英]File provider exception in Xamarin.Android

When i add a image to drawable resources, and i use it in a layout.当我将图像添加到可绘制资源并在布局中使用它时。 When i run the application, Visual Studio prompts me an exception of unable to get provider xamarin.essentials.file.providers:java.lang.IllegalArgumentsException: Missing android.support当我运行应用程序时,Visual Studio 提示我无法获取提供程序 xamarin.essentials.file.providers:java.lang.IllegalArgumentsException: Missing ZC31B32364CE19CA58FCD150A417 的异常。

(1)Image error: file_provider_exception (1)图像错误: file_provider_exception

(2)My actual layout xml code: (2)我的实际布局 xml 代码:

layout_xml_code layout_xml_code

Welcome to StackOverflow!欢迎来到 StackOverflow!

Somewhere in your code, you are trying to allow users to upload files from their phone.在您的代码中的某处,您正试图允许用户从他们的手机上传文件。 The ImageView shouldn't be causing the problem, and the complete error message should say Missing android.support.FILE_PROVIDER_PATHS meta-data ImageView 应该不会导致问题,完整的错误消息应该是Missing android.support.FILE_PROVIDER_PATHS meta-data

And in order to make that go away, you need to add this in your AndroidManifest file为了使 go 消失,您需要将其添加到您的 AndroidManifest 文件中

<meta-data
    android:name="android.support.FILE_PROVIDER_PATHS" 
    android:resource="@xml/provider_paths" />

have you miss the configration in your AndroidManifest.xml :您是否错过了AndroidManifest.xml中的配置:

<provider
   android:name="android.support.v4.content.FileProvider"
   android:authorities="packagename.fileProvider"
   android:grantUriPermissions="true"
   android:exported="false">

   <meta-data
      android:name="android.support.FILE_PROVIDER_PATHS"
      android:resource="@xml/file_paths" />
</provider>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM