Hello, I'm trying to share a PDF file with this code:
var _pdfFilePath = '/data/user/0/com.drelliseo_pharmacy/app_flutter/temp.pdf'; await Share.shareXFiles([XFile(_pdfFilePath)], text: 'Some text');
The above code works correctly on a device with Android 10, however, it doesn't work on another device with Android 11.
In the debug console, it doesn't throw any errors or messages.
When the code runs, everything seems to work – it opens the share screen correctly, opens WhatsApp, displays the file to send on the screen, but in the end, it doesn't send the file.
Some considerations:
This same code works correctly on Android 10.
Until a few days ago, everything was working correctly, but suddenly it started failing.
The error is only identified when trying to share with WhatsApp (sharing by email, for example, works).
The WhatsApp version on both devices is the same (2.24.6.77).
Code Sample
var _pdfFilePath = '/data/user/0/com.drelliseo_pharmacy/app_flutter/temp.pdf';
await Share.shareXFiles([XFile(_pdfFilePath)], text: 'Some text');
[√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Version 10.0.22631.3296], locale es-MX)
• Flutter version 3.19.5 on channel stable at C:\Users\raval\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 300451adae (12 days ago), 2024-03-27 21:54:07 -0500
• Engine revision e76c956498
• Dart version 3.3.3
• DevTools version 2.31.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\raval\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.10)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
• Visual Studio Build Tools 2019 version 16.11.32126.315
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[√] Android Studio (version 2023.1)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
[√] VS Code (version 1.88.0)
• VS Code at C:\Users\raval\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.86.0
[√] Connected device (5 available)
• A10Pro (mobile) • U4KMG2E726PJOO6UOMW • android-arm64 • Android 8.1.0 (API 27)
• SM G9650 (mobile) • 192.168.1.72:5555 • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3296]
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.111
• Edge (web) • edge • web-javascript • Microsoft Edge 119.0.2151.72
[√] Network resources
• All expected network resources are available.
• No issues found!
Checklist before submitting a bug
[X] I searched issues in this repository and couldn't find such bug/problem
[X] I Google'd a solution and I couldn't find it
[X] I searched on StackOverflow for a solution and I couldn't find it
[X] I read the README.md file of the plugin
[X] I'm using the latest version of the plugin
[X] All dependencies are up to date with flutter pub upgrade
Platform
Android 11
Plugin
share_plus
Version
8.0.3
Flutter SDK
3.19.5
Steps to reproduce
Hello, I'm trying to share a PDF file with this code:
var _pdfFilePath = '/data/user/0/com.drelliseo_pharmacy/app_flutter/temp.pdf'; await Share.shareXFiles([XFile(_pdfFilePath)], text: 'Some text');
The above code works correctly on a device with Android 10, however, it doesn't work on another device with Android 11.
In the debug console, it doesn't throw any errors or messages.
When the code runs, everything seems to work – it opens the share screen correctly, opens WhatsApp, displays the file to send on the screen, but in the end, it doesn't send the file.
Some considerations:
Code Sample
Logs
Flutter Doctor
Checklist before submitting a bug
flutter pub upgrade
flutter clean