fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.55k stars 921 forks source link

[Bug]: Share_plus is not working with WhatsApp (Android 11) #2828

Closed ravalosv closed 4 months ago

ravalosv commented 4 months ago

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:

01

02 03

04

Code Sample

var _pdfFilePath = '/data/user/0/com.drelliseo_pharmacy/app_flutter/temp.pdf';
await Share.shareXFiles([XFile(_pdfFilePath)], text: 'Some text');

Logs

[+17173 ms] D/GraphicBuffer(32373): register, handle(0x7b38027680) (w:800 h:1217 s:800 f:0x1 u:b00)
[+5021 ms] I/GLConsumer(32373): [SurfaceTexture-0-32373-1] detachFromContext
[   +6 ms] D/Surface (32373): Surface::disconnect(this=0x7b3915e000,api=1)
[   +1 ms] D/GraphicBuffer(32373): unregister, handle(0x7b5be21920) (w:800 h:1217 s:800 f:0x1 u:b00)
[   +1 ms] D/GraphicBuffer(32373): unregister, handle(0x7b5be21e60) (w:800 h:1217 s:800 f:0x1 u:b00)
[   +1 ms] D/GraphicBuffer(32373): unregister, handle(0x7b38026260) (w:800 h:1217 s:800 f:0x1 u:b00)
[   +1 ms] D/Surface (32373): Surface::disconnect(this=0x7b3915e000,api=-1)
[  +11 ms] V/PhoneWindow(32373): DecorView setVisiblity: visibility = 4, Parent = ViewRoot{34b2924
com.drelliseo_pharmacy/com.drelliseo_pharmacy.MainActivity,ident = 0}, this = DecorView@1096cb6[MainActivity]
[  +62 ms] D/Surface (32373): Surface::disconnect(this=0x7b403a7000,api=1)
[   +1 ms] D/GraphicBuffer(32373): unregister, handle(0x7b5be23520) (w:800 h:1280 s:800 f:0x1 u:b00)
[+15144 ms] V/PhoneWindow(32373): DecorView setVisiblity: visibility = 0, Parent = ViewRoot{34b2924
com.drelliseo_pharmacy/com.drelliseo_pharmacy.MainActivity,ident = 0}, this = DecorView@1096cb6[MainActivity]
[  +25 ms] D/Surface (32373): Surface::connect(this=0x7b403a7000,api=1)
[   +5 ms] D/Surface (32373): Surface::connect(this=0x7b64863000,api=1)
[  +20 ms] E/BpSurfaceComposerClient(32373): Failed to transact (-1)
[        ] I/GLConsumer(32373): [SurfaceTexture-0-32373-1] attachToContext
[        ] E/BpSurfaceComposerClient(32373): Failed to transact (-1)
[  +10 ms] D/GraphicBuffer(32373): register, handle(0x7b5be215a0) (w:800 h:1217 s:800 f:0x1 u:b00)
[  +17 ms] D/GraphicBuffer(32373): register, handle(0x7b5be21e60) (w:800 h:1217 s:800 f:0x1 u:b00)
[  +18 ms] D/Surface (32373): lockHardwareCanvas
[  +18 ms] I/BufferQueueProducer(32373): [SurfaceTexture-0-32373-1](this:0x7b38d03000,id:1,api:1,p:32373,c:32373) queueBuffer: fps=0.03
dur=37551.53 max=37551.53 min=37551.53
[   +4 ms] D/GraphicBuffer(32373): register, handle(0x7b5be23520) (w:800 h:1280 s:800 f:0x1 u:b00)

Flutter Doctor

[√] 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

miquelbeltran commented 4 months ago

Please read the README file, it details the limitations imposed by Meta apps regarding the share functionality.