使用shared_preferences插件报错,求解决

来源:9-5 基于shared_preferences本地存储操作【本地存储】

Dejan_he

2023-01-11

Syncing files to device Android SDK built for x86…
Reloaded 1 of 663 libraries in 407ms.
E/flutter ( 8277): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
E/flutter ( 8277):
E/flutter ( 8277): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
E/flutter ( 8277):
E/flutter ( 8277): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
E/flutter ( 8277):

写回答

2回答

Dejan_he

提问者

2023-01-12

最终排查出了问题是"本地的Android SDK版本没有对应上shared_preferences插件最新版本的支持", 解决办法: cmd 执行> flutter doctor。根据错误的选项一项一项的修复即可.

√  Built build\app\outputs\flutter-apk\app-debug.apk.

Installing build\app\outputs\flutter-apk\app.apk...

Debug service listening on ws://127.0.0.1:3101/FZrHnIA_7e0=/ws

Syncing files to device Android SDK built for x86...

D/EGL_emulation(10051): eglMakeCurrent: 0xdc413460: ver 2 0 (tinfo 0xc8fb1560)

D/EGL_emulation(10051): eglMakeCurrent: 0xdc412e60: ver 2 0 (tinfo 0xc8fb11d0)


1
0

CrazyCodeBoy

2023-01-12

执行下flutter pub get
然后将APP卸载重新安装看看。
0
2
Dejan_he
执行 flutter doctor, 如果有错误选项就修复错误的选项。然后再去flutter\bin目录,删除cache目录下的flutter_tools.snapshot 文件,接着再执行一次 flutter doctor, 这时会自动执行以下 Building flutter tool... Running pub upgrade... 完成后 No issues found! Process finished with exit code 0 问题解决了。
2023-01-12
共2条回复

Flutter从入门到进阶 实战携程网App 一网打尽核心技术

解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。

4788 学习 · 3270 问题

查看课程