Platform
Android 16
Plugin
share_plus
Version
12.0.1
Flutter SDK
3.41.2
Steps to reproduce
Native Android implementation of share_plus is performing IO operations on main thread, which is consequently flagged when running with a StrictMode.ThreadPolicy set.
This issue can be reproduced by executing any call to SharePlus.instance.share even when supplying non-file parameters since native implementation always starts with clearing share cache folder.
A demo with enabled StrictMode is available at https://github.com/alverone/share_plus_main_thread_io.
Steps to reproduce:
- Enable StrictPolicy in native
FlutterActivity or Application classes.
- Run the application in debug mode.
- Enter text into the 'Share text' field.
- Tap the 'Share' button.
- Inspect logs for
StrictMode violations.
Logs
Example of the warning and an offending stack trace produced by StrictMode:
D/StrictMode(23831): StrictMode policy violation; ~duration=27 ms: android.os.strictmode.DiskReadViolation
D/StrictMode(23831): at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1728)
D/StrictMode(23831): at libcore.io.BlockGuardOs.access(BlockGuardOs.java:74)
D/StrictMode(23831): at libcore.io.ForwardingOs.access(ForwardingOs.java:128)
D/StrictMode(23831): at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:8944)
D/StrictMode(23831): at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:332)
D/StrictMode(23831): at java.io.File.exists(File.java:829)
D/StrictMode(23831): at android.app.ContextImpl.getDataDir(ContextImpl.java:3347)
D/StrictMode(23831): at android.app.ContextImpl.getCacheDir(ContextImpl.java:923)
D/StrictMode(23831): at android.content.ContextWrapper.getCacheDir(ContextWrapper.java:328)
D/StrictMode(23831): at dev.fluttercommunity.plus.share.Share.getShareCacheFolder(Share.kt:29)
D/StrictMode(23831): at dev.fluttercommunity.plus.share.Share.clearShareCacheFolder(Share.kt:230)
D/StrictMode(23831): at dev.fluttercommunity.plus.share.Share.share(Share.kt:60)
D/StrictMode(23831): at dev.fluttercommunity.plus.share.MethodCallHandler.onMethodCall(MethodCallHandler.kt:26)
D/StrictMode(23831): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
D/StrictMode(23831): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:286)
D/StrictMode(23831): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:313)
D/StrictMode(23831): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
D/StrictMode(23831): at android.os.Handler.handleCallback(Handler.java:995)
D/StrictMode(23831): at android.os.Handler.dispatchMessage(Handler.java:103)
D/StrictMode(23831): at android.os.Looper.loopOnce(Looper.java:248)
D/StrictMode(23831): at android.os.Looper.loop(Looper.java:338)
D/StrictMode(23831): at android.app.ActivityThread.main(ActivityThread.java:9067)
D/StrictMode(23831): at java.lang.reflect.Method.invoke(Native Method)
D/StrictMode(23831): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
D/StrictMode(23831): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
Flutter Doctor
fvm flutter doctor -v
[✓] Flutter (Channel stable, 3.41.2, on macOS 26.3 25D125 darwin-arm64, locale en-GB) [1,051ms]
• Flutter version 3.41.2 on channel stable at /Users/artem/fvm/versions/3.41.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 90673a4eef (2 weeks ago), 2026-02-18 13:54:59 -0800
• Engine revision 6c0baaebf7
• Dart version 3.11.0
• DevTools version 2.54.1
• Feature flags: no-enable-web, no-enable-linux-desktop, no-enable-macos-desktop,
no-enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1) [2.4s]
• Android SDK at /Users/artem/Library/Android/sdk
• Emulator version 36.4.9.0 (build_id 14788078) (CL:N/A)
• Platform android-36.1, build-tools 36.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.9+-14649483-b1163.86)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 26.3) [2.4s]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17C529
• CocoaPods version 1.16.2
[✓] Connected device (1 available) [6.4s]
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android
16 (API 36) (emulator)
[✓] Network resources [220ms]
• All expected network resources are available.
• No issues found!
Checklist before submitting a bug
Platform
Android 16
Plugin
share_plus
Version
12.0.1
Flutter SDK
3.41.2
Steps to reproduce
Native Android implementation of share_plus is performing IO operations on main thread, which is consequently flagged when running with a
StrictMode.ThreadPolicyset.This issue can be reproduced by executing any call to
SharePlus.instance.shareeven when supplying non-file parameters since native implementation always starts with clearing share cache folder.A demo with enabled
StrictModeis available at https://github.com/alverone/share_plus_main_thread_io.Steps to reproduce:
FlutterActivityorApplicationclasses.StrictModeviolations.Logs
Example of the warning and an offending stack trace produced by
StrictMode:Flutter Doctor
fvm flutter doctor -v [✓] Flutter (Channel stable, 3.41.2, on macOS 26.3 25D125 darwin-arm64, locale en-GB) [1,051ms] • Flutter version 3.41.2 on channel stable at /Users/artem/fvm/versions/3.41.2 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 90673a4eef (2 weeks ago), 2026-02-18 13:54:59 -0800 • Engine revision 6c0baaebf7 • Dart version 3.11.0 • DevTools version 2.54.1 • Feature flags: no-enable-web, no-enable-linux-desktop, no-enable-macos-desktop, no-enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration [✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1) [2.4s] • Android SDK at /Users/artem/Library/Android/sdk • Emulator version 36.4.9.0 (build_id 14788078) (CL:N/A) • Platform android-36.1, build-tools 36.1.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java This JDK is specified in your Flutter configuration. To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`. • Java version OpenJDK Runtime Environment (build 21.0.9+-14649483-b1163.86) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 26.3) [2.4s] • Xcode at /Applications/Xcode.app/Contents/Developer • Build 17C529 • CocoaPods version 1.16.2 [✓] Connected device (1 available) [6.4s] • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 16 (API 36) (emulator) [✓] Network resources [220ms] • All expected network resources are available. • No issues found!Checklist before submitting a bug
flutter pub upgradeflutter clean