简体   繁体   中英

MissingPluginException When Using Plugins in Flutter Alarm Manager Callbacks

I keep getting this exception when I use shared_preferences plugin in the android_alarm_manager callbacks even though I have followed all the steps in the plugin documentation.

Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)

I have created this project recently on top of flutter version 1.20 which uses Flutter Android Embedding V2 so it should register plugins automatically.

Flutter Doctor Output:

[✓] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.19041.450], locale en-US)
    • Flutter version 1.20.2 at C:\src\flutter
    • Framework revision bbfbf1770c (2 weeks ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at D:\Android\Sdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_HOME = D:\Android\Sdk
    • Java binary at: D:\Program Files\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[✓] Android Studio (version 4.0)
    • Android Studio at D:\Program Files\Android Studio
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[✓] VS Code (version 1.47.2)
    • VS Code at C:\Users\MOHNAD\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.12.2

[✓] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

Thanks in advance

I was able to solve this problem by removing this package keyboard_visibility: ^0.5.6 which was causing this warning from FlutterEngine

W/FlutterEngine(10724): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@8ca5659) but could not find and invoke the GeneratedPluginRegistrant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM