[shared_preferences] Android exception: `Unable to establish connection on channel: "dev.flutter.pigeon.shared_preferences_android.SharedPreferencesApi.getAll"`
Problem
Long explanation of what is happening https://github.com/flutter/flutter/issues/153075#issuecomment-3313363609 TLDR: Update your Android Gradle Plugin version to 8.9.1 or higher and ensure that all of your android plugins are using at least AGP 8.9.1 or higher. If you have a reproduction that is using AGP 8.9.1 and higher for an app and all of its plugins please add a comment with your reproduction. Steps to reproduce 1. Use old api of shared preferences. 2. Build the app. Expected results It should work with old api of shared preferences. Actual results Getting exception as below Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.shared_preferences_android.SharedPreferencesApi.getAll"., null, null) Code sample <details open><summary>Code sample</summary> [code block] </details> Screenshots or Video <details open> <summary>Screenshots / Video demonstration</summary> [Upload media here] </details> Logs <details open><summary>Logs</summary> [code block] </details> Flutter Doctor output <details open><summary>Doctor output</summary> [code block] </details>
Error Output
Exception: PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.shared_preferences_android.SharedPreferencesApi.getAll"., null, null)
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [shared_preferences] Android exception: `Unable to establish connection on channel: "dev.flutter.pigeon.shared_preferences_android.SharedPreferencesApi.getAll"`
Hi @shubham-ctl Which `shared_preferences_android` package version you are using? (Please check it on `pubspec.lock` file). Please also provide the entire output of `flutter run -v` to see the complete crash stack trace. Thanks!
Trust Score
1 verification
- 1
Hi @shubham-ctl
Which `shared_preferences_android` package version you are using? (Please check it on `pubspec.lock` file).
- 2
Please also provide the entire output of `flutter run -v` to see the complete cr
Please also provide the entire output of `flutter run -v` to see the complete crash stack trace. Thanks!
Validation
Resolved in flutter/flutter GitHub issue #153075. Community reactions: 0 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep