Flutter:google_sign_in插件MissingPluginException [英] Flutter: google_sign_in plugin MissingPluginException

查看:89
本文介绍了Flutter:google_sign_in插件MissingPluginException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Google登录插件正常运行,但没有成功.我把它放在我的pubspec.yaml中,并运行了flutter程序包,但是仍然没有运气. 引发以下异常:

I'm trying to get the google sign in plugin to work without any success. I've put it in my pubspec.yaml and ran flutter packages get but still no luck. The following exception is thrown:

E/flutter ( 3313): [ERROR:../../lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 3313): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)

我正在使用Android.尚未有机会针对iOS进行测试. 有什么建议吗?

I'm working on Android. Haven't had a chance to test it for iOS yet. Any suggestions?

推荐答案

嗯,听起来您使用的是旧版本.首先flutter upgrade.

Hmm, it sounds like you are on an old version of something. First flutter upgrade.

您的MainActivity.java应该看起来像这样:

Your MainActivity.java should look something like this:

package com.yourcompany.example;

import android.os.Bundle;

import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }
}

您的pubspec.yaml应该说:

Your pubspec.yaml should say:

dependencies:
  flutter:
    sdk: flutter
  google_sign_in: ^0.0.2

如果这不起作用,请尝试创建一个新项目,然后将文件和资产复制过来.

If that doesn't work, try creating a new project and copying your files and assets over.

如果仍然遇到该错误,请尝试运行flutter doctor并将文本添加到您的问题中.

If it still is running into that error, try running flutter doctor and add the text to your question.

这篇关于Flutter:google_sign_in插件MissingPluginException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆