[英]Unhandled Exception: MissingPluginException(No implementation found for method ... on channel ...)
[英]Unhandled Exception: MissingPluginException: No implementation found for method xx on channel
我面臨一個錯誤,即我在某個日期之后實現的所有插件都不起作用。 我在互聯網上嘗試了所有方法(重新安裝,flutter 清理,重建......),但它們都不起作用,所以也許我處於一個非常奇怪的情況。
這是我的 yaml 文件:
dependencies:
flutter:
sdk: flutter
http :
intl:
cupertino_icons: ^1.0.3
flutter_svg: ^0.23.0+1
pin_code_fields: ^7.3.0
flutter_secure_storage: ^4.2.1
iban: ^1.0.1
sqflite: ^2.0.0+4
path: ^1.6.4
webview_flutter : ^2.3.0
qr_flutter: ^4.0.0 #qrcode generation
qrcode_flutter: ^2.0.1
url_launcher: ^6.0.12 #launching url
uuid: ^3.0.5
encrypt: ^5.0.1
simple_rsa: ^0.0.5
crypto: ^3.0.1
crypto_keys: ^0.3.0
dio: ^4.0.1
pointycastle: ^3.3.4
//from here, bottom plugins don't work
screenshot: ^1.2.3
image_gallery_saver: ^1.7.1
permission_handler: ^8.2.6
email_validator: ^2.0.1 //surprisingly email_validator works
share_plus: ^3.0.4
flutter博士:
[✓] Flutter (Channel master, 2.6.0-12.0.pre.837, on macOS 12.0.1 21A559 darwin-x64, locale zh-Hans-FR)
• Flutter version 2.6.0-12.0.pre.837 at /Users/liuqishu/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 341e771b12 (5 days ago), 2021-11-24 19:33:04 -0500
• Engine revision e99aba6a38
• Dart version 2.16.0 (build 2.16.0-46.0.dev)
• DevTools version 2.8.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/liuqishu/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio 4.2
Preview.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
• 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
• Android Studio at /Applications/Android Studio 4.2 Preview.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.8+10-b944.6916264)
[✓] VS Code (version 1.62.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.28.0
[✓] Connected device (3 available)
• Qishu’s iPhone (mobile) • 00008101-0011358401E2001E • ios • iOS 15.1.1
19B81
• iPhone 13 (mobile) • 56F3E614-0B41-4F96-B7B5-FEE3D5E63006 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome
96.0.4664.55
• No issues found!
錯誤日志:(以 plugins share 為例,實際上我現在實現的任何插件都會顯示相同類型的錯誤)
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method share on channel dev.fluttercommunity.plus/share)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:175:7)
<asynchronous suspension>
所有的建議將不勝感激。
好吧,最后我想通了這個問題,我不確定我是否處於非常特殊的情況,但無論如何這里是解決方案:每次構建應用程序時,即使插件會正確安裝,但路徑的插件未在GeneratedPluginRegistrant.m
中正確導入。 因此,在手動導入它們之后,它就可以工作了!
ps:插件路徑: /your_project_folder/ios/Pods/Target Support Files
關於如何在GeneratedPluginRegistrant.m
中手動添加插件的示例:
#if __has_include(<qrcode/QrcodePlugin.h>)
#import <qrcode/QrcodePlugin.h>
#else
@import qrcode_flutter;
#endif
只需添加
'SharedPreferences.setMockInitialValues({});
在使用共享首選項之前
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.