plus_plugins
plus_plugins copied to clipboard
[Bug]: SharewithResult always returning null in Android
Platform
Android 11
Plugin
share_plus
Version
4.0.8
Flutter SDK
3.0.2
Steps to reproduce
- use shareFilesWithResult and check the result. result.raw returns null
Code Sample
No response
Logs
[+54664 ms] Observatory URL on device: http://127.0.0.1:34899/7ETFkDQwO_Q=/
[ +2 ms] executing: /Users/vgts/Library/Android/sdk/platform-tools/adb -s emulator-5554 forward tcp:0 tcp:34899
[ +34 ms] 52673
[ ] Forwarded host port 52673 to device port 34899 for Observatory
[ +11 ms] Caching compiled dill
[ +295 ms] Connecting to service protocol: http://127.0.0.1:52673/7ETFkDQwO_Q=/
[ +659 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at
http://127.0.0.1:52673/7ETFkDQwO_Q=/.
[ +288 ms] DDS is listening at http://127.0.0.1:52682/LB1yIN6BQhk=/.
[ +103 ms] Successfully connected to service protocol: http://127.0.0.1:52673/7ETFkDQwO_Q=/
[ +173 ms] DevFS: Creating new filesystem on the device (null)
[ +75 ms] DevFS: Created new filesystem on the device (file:///data/user/0/io.flutter.plugins.shareexample/code_cache/exampleWMUXHN/example/)
[ +4 ms] Updating assets
[ +214 ms] Syncing files to device sdk gphone x86...
[ +3 ms] <- reset
[ ] Compiling dart to kernel with 0 updated files
[ ] Processing bundle.
[ +1 ms] <- recompile package:share_example/main.dart 260be2e5-1266-4797-b78b-e46ac513b004
[ ] <- 260be2e5-1266-4797-b78b-e46ac513b004
[ +3 ms] Bundle processing done.
[ +513 ms] Updating files.
[ ] DevFS: Sync finished
[ +2 ms] Syncing files to device sdk gphone x86... (completed in 523ms)
[ ] Synced 0.0MB.
[ +4 ms] <- accept
[ +5 ms] Connected to _flutterView/0xf52865e0.
[ +5 ms] Flutter run key commands.
[ +2 ms] r Hot reload. π₯π₯π₯
[ +1 ms] R Hot restart.
[ ] h List all available interactive commands.
[ ] d Detach (terminate "flutter run" but leave application running).
[ ] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ ] πͺ Running with sound null safety πͺ
[ +1 ms] An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:52682/LB1yIN6BQhk=/
[+2073 ms] The Flutter DevTools debugger and profiler on sdk gphone x86 is available at:
http://127.0.0.1:9100?uri=http://127.0.0.1:52682/LB1yIN6BQhk=/
[+3299 ms] I/AssistStructure(26783): Flattened final assist data: 532 bytes, containing 1 windows, 3 views
[+4850 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +13 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +6 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +6 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +2 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +30 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ +4 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +5 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ +2 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +1 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +113 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +2 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +7 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +24 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +34 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +210 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +3 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +13 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +1 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +51 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +2 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +7 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +19 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +81 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +2 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +9 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[+1078 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +7 ms] I/AssistStructure(26783): Flattened final assist data: 524 bytes, containing 1 windows, 3 views
[ ] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +723 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +8 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +2 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +9 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +173 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +12 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +12 ms] W/IInputConnectionWrapper(26783): setComposingRegion on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +313 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +6 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +6 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +11 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +4 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +14 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +31 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ +2 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +2 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[+1244 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +49 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +13 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +15 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +195 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +13 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[+1079 ms] I/TextInputPlugin(26783): Composing region changed by the framework. Restarting the input method.
[ +13 ms] W/ListenableEditingState(26783): a listener was added to EditingState while a batch edit was in progress
[ +89 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[ +76 ms] W/IInputConnectionWrapper(26783): setComposingRegion on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +3 ms] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ +20 ms] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +88 ms] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getSelectedText on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextAfterCursor on inactive InputConnection
[ +90 ms] W/IInputConnectionWrapper(26783): beginBatchEdit on inactive InputConnection
[ ] W/IInputConnectionWrapper(26783): getTextBeforeCursor on inactive InputConnection
[ +19 ms] W/IInputConnectionWrapper(26783): endBatchEdit on inactive InputConnection
[+8172 ms] I/System.out(26783): onReceuve
[ +2 ms] I/System.out(26783): null
[ +254 ms] I/flutter (26783): ShareResultStatus.success
[ ] I/flutter (26783): null
Flutter Doctor
[β] Flutter (Channel stable, 3.0.2, on macOS 12.2.1 21D62 darwin-x64, locale en-IN)
β’ Flutter version 3.0.2 at /Users/vgts/Documents/flutter
β’ Upstream repository https://github.com/flutter/flutter.git
β’ Framework revision cd41fdd495 (11 days ago), 2022-06-08 09:52:13 -0700
β’ Engine revision f15f824b57
β’ Dart version 2.17.3
β’ DevTools version 2.12.2
[β] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
β’ Android SDK at /Users/vgts/Library/Android/sdk
β’ Platform android-31, build-tools 30.0.3
β’ ANDROID_HOME = /Users/vgts/Library/Android/sdk
β’ ANDROID_SDK_ROOT = /Users/vgts/Library/Android/sdk
β’ Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
β’ Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
β’ All Android licenses accepted.
[β] Xcode - develop for iOS and macOS (Xcode 13.3)
β’ Xcode at /Applications/Xcode.app/Contents/Developer
β’ CocoaPods version 1.11.2
[β] Chrome - develop for the web
β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[β] Android Studio (version 2021.1)
β’ Android Studio at /Applications/Android Studio.app/Contents
β’ 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.11+0-b60-7590822)
[β] VS Code (version 1.68.1)
β’ VS Code at /Applications/Visual Studio Code.app/Contents
β’ Flutter extension version 3.42.0
[β] Connected device (3 available)
β’ sdk gphone x86 (mobile) β’ emulator-5554 β’ android-x86 β’ Android 11 (API 30) (emulator)
β’ macOS (desktop) β’ macos β’ darwin-x64 β’ macOS 12.2.1 21D62 darwin-x64
β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 102.0.5005.115
[β] HTTP Host Availability
β’ All required HTTP hosts are available
β’ No issues found!
having the same issue with the latest package version. @santhoshvgts 4.0.4 of share_plus is working properly for me, but the current one isnt
@Letalus I tried 4.0.4 but same issue
Hi there,
are you really seeing ShareResult.raw == null
?
The definition of the raw property is as follows:
final String raw;
The dart null safety guarantees that the raw
property cannot be null
.
Please explain your issue a bit clearer :)
@Coronon
https://github.com/fluttercommunity/plus_plugins/pull/800#issue-1175203282
shareWithresult fallback to share if the result is null
I am currently very short on time but will probably find some at the end of the month. When I last tried this I wasnβt able to reproduce this. Would you guys mind sharing a sample project for me to be on the same page? I am only able to test with the android emulator as I am not in possession of a real android device.
I had the same problem when running on Android 11, but Android 10 was normal
print(result.raw == "null");//true its not null its string "null"
@Coronon
intent.getParcelableExtra<ComponentName>(Intent.EXTRA_CHOSEN_COMPONENT)
returns null
I have the same problem in version 4.4.0
final res = await Share.shareWithResult('some text',subject: title);
print(res.status);
print(res.raw);
@aakash-pamnani Thanks for your hint. Sadly, my PC broke and I was unable to work on this with my old Macbook. I expect to be able to look into the issue this weekend. As I donβt have an android device the hint that the new Android version might have something to do with it is greatly appreciated :)
@Coronon PendingIntent.FLAG_IMMUTABLE
is the problem, changing it to PendingIntent.FLAG_MUTABLE
returns the package name of the app clicked.
Is it ok using PendingIntent.FLAG_MUTABLE
then i wil create a PR.
@aakash-pamnani If I remember correctly, there was a problem with the MUTABLE
option. Something else in the code broke back then - I'll have to look into the old PRs. What's interesting is that I was not able to find anything in the change logs between Android v10 and v11 that would hint at any change in behaviour...
Finally got around to look into this and was able to reproduce it - now looking into a fix.
Okay, so I finally got a fix working that resolves the issue and cleans up the little callback-hell, while protecting us from any integrity issues a FLAG_MUTABLE
Intent may carry.
It is really late at night for me, so I'll clean up my changes tomorrow to then submit a PR :) Sorry again for the huge delay, I was sadly really busy :/
PS: It really is a nightmare to debug this with an Android emulator on a Mid 2012 Macbook Air lol
As I just submitted my PR, I would love for everyone to try out the changes to see if they fix the issue outside my simulator.
As always, I provide share_plus_example as a pre-setup example project for this PR.
You may also try out this PR in your own projects using these dependency overrides in your pubspec.yml
:
dependency_overrides:
share_plus:
git:
url: https://github.com/Coronon/plus_plugins
ref: 488a27c5a6ca2cadb1a27591b5c17a1986cbd8b1
path: packages/share_plus/share_plus
share_plus_platform_interface:
git:
url: https://github.com/Coronon/plus_plugins
ref: 488a27c5a6ca2cadb1a27591b5c17a1986cbd8b1
path: packages/share_plus/share_plus_platform_interface
Its working @Coronon