MissingPluginException(在通道 com.amazonaws.amplify/amplify 上找不到方法配置的实现)
Posted
技术标签:
【中文标题】MissingPluginException(在通道 com.amazonaws.amplify/amplify 上找不到方法配置的实现)【英文标题】:MissingPluginException(No implementation found for method configure on channel com.amazonaws.amplify/amplify) 【发布时间】:2021-05-25 19:20:34 【问题描述】:配置身份验证插件后运行Amplify Flutter tutorial项目时,不断收到以下错误:
Error: MissingPluginException(No implementation found for method configure on channel com.amazonaws.amplify/amplify)
at Object.throw_ [as throw] (http://localhost:56261/dart_sdk.js:5331:11)
at MethodChannel._invokeMethod (http://localhost:56261/packages/flutter/src/services/system_channels.dart.lib.js:954:21)
at _invokeMethod.next (<anonymous>)
at http://localhost:56261/dart_sdk.js:39029:33
at _RootZone.runUnary (http://localhost:56261/dart_sdk.js:38886:58)
at _FutureListener.thenAwait.handleValue (http://localhost:56261/dart_sdk.js:33872:29)
at handleValueCallback (http://localhost:56261/dart_sdk.js:34432:49)
at Function._propagateToListeners (http://localhost:56261/dart_sdk.js:34470:17)
at _Future.new.[_completeWithValue] (http://localhost:56261/dart_sdk.js:34312:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:56261/dart_sdk.js:34335:35)
at Object._microtaskLoop (http://localhost:56261/dart_sdk.js:39173:13)
at _startMicrotaskLoop (http://localhost:56261/dart_sdk.js:39179:13)
at http://localhost:56261/dart_sdk.js:34686:9
main.dart
中的以下代码直接从 Amplify Flutter 复制而来,但仅使用了 Auth 插件:
class _MyHomePageState extends State<MyHomePage>
@override
initState()
super.initState();
_configureAmplify();
void _configureAmplify() async
AmplifyAuthCognito authPlugin = AmplifyAuthCognito();
Amplify.addPlugin(authPlugin);
try
await Amplify.configure(amplifyconfig); # <--- this is what throws the MissingPluginException
on AmplifyAlreadyConfiguredException
print(
"Tried to reconfigure Amplify; this can occur when your app restarts on android.");
...
pubspec.yaml:
name: <myproject>
description: <description>
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
amplify_flutter: '<1.0.0'
amplify_auth_cognito: '<1.0.0'
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
是的,是的,我已经搜索过 *** 和 github。我已经尝试了任何人的建议,包括:
关闭应用程序,运行flutter clean
然后flutter pub get
更新我的所有依赖项
缓存无效并重新启动 Android Studio
确保小部件通过在main()
中调用WidgetsFlutterBinding.ensureInitialized()
进行初始化
确保在加载 Auth 插件之前我没有调用 Amplify.configure()
开始一个全新的项目并重新初始化 Amplify
【问题讨论】:
你重启你的应用了吗? 很多次 【参考方案1】:截至发帖时,Amplify-Flutter 不支持 Web 平台,在此之前此错误是预期行为。见:https://github.com/aws-amplify/amplify-flutter/issues/234
【讨论】:
以上是关于MissingPluginException(在通道 com.amazonaws.amplify/amplify 上找不到方法配置的实现)的主要内容,如果未能解决你的问题,请参考以下文章
MissingPluginException(未找到通道上的方法的实现)
GoogleMaps Flutter 插件 MissingPluginException
发布模式android中的MissingPluginException
尝试直接从 FLUTTER 发出呼叫:MissingPluginException(未找到方法 callNumber 的实现
android Unhandled Exception 上的 Flutter 运行错误:MissingPluginException(未找到方法的实现)
MissingPluginException(在通道 com.amazonaws.amplify/amplify 上找不到方法配置的实现)