Description
When attempting to share a locally generated file (e.g., from FileSystem.CacheDirectory) using Share.RequestAsync, the application throws a exception on modern Android devices (Android 10+) with a java.lang.SecurityException.
The exception states: Permission Denial: reading microsoft.maui.essentials.fileProvider uri... from uid=1000 requires the provider be exported, or grantUriPermission().
Steps to Reproduce
- Download the Sample Project
- Run the app on an Android 10+ device (e.g., Android 13)
- Attempt to share the "dotnet_bot" file using MAUI Essentials, via the Share button
- Trigger the Share Image Button, the action will succeed but a preview image will not be shown for the share action and a error will be shown in the output window.
- Trigger the Share Image (Fixed ClipIntent) Button to observe that using a native Android implementation that explicitly sets the ClipIntent fixes the error
Link to public reproduction project repository
https://github.com/Marc0d3/MauiMissingClipIntent
Version with bug
10.0.1
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 10+ (API 29 and higher). Specifically reproduced on Android 13.
Did you find any workaround?
Yes. Bypassing Share.RequestAsync and using a native Android implementation that explicitly sets ClipData resolves the issue completely. This can be tested out in the sample project.
Relevant log output
14:05:15:215 03-08 14:05:12.860 E/DatabaseUtils(10599): java.lang.SecurityException: Permission Denial: reading microsoft.maui.essentials.fileProvider uri content://com.companyname.mauimissingclipintent.fileProvider/internal_cache/dotnet_bot.png from pid=9976, uid=1000 requires the provider be exported, or grantUriPermission()
Description
When attempting to share a locally generated file (e.g., from FileSystem.CacheDirectory) using Share.RequestAsync, the application throws a exception on modern Android devices (Android 10+) with a java.lang.SecurityException.
The exception states: Permission Denial: reading microsoft.maui.essentials.fileProvider uri... from uid=1000 requires the provider be exported, or grantUriPermission().
Steps to Reproduce
Link to public reproduction project repository
https://github.com/Marc0d3/MauiMissingClipIntent
Version with bug
10.0.1
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 10+ (API 29 and higher). Specifically reproduced on Android 13.
Did you find any workaround?
Yes. Bypassing Share.RequestAsync and using a native Android implementation that explicitly sets ClipData resolves the issue completely. This can be tested out in the sample project.
Relevant log output
14:05:15:215 03-08 14:05:12.860 E/DatabaseUtils(10599): java.lang.SecurityException: Permission Denial: reading microsoft.maui.essentials.fileProvider uri content://com.companyname.mauimissingclipintent.fileProvider/internal_cache/dotnet_bot.png from pid=9976, uid=1000 requires the provider be exported, or grantUriPermission()