MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in) after publishing to Google Play Store

女生的网名这么多〃 提交于 2021-02-05 07:31:50

问题


I asked a similar question before, but I am having trouble with Google Sign-in after publishing my app to internal and closed testing on the Play store. It works perfectly well on emulators for both Android and iOS, works great on real devices when I run it from my computer in debug and release modes, but once published to the Play store, everything breaks. The error I get is

MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)

Is there anything in particular I'm missing? I have a feeling this is a one-step solution and I just can't find it.


回答1:


I had the same problem as you (same error message, using Flutter, only occuring after app store) and was able to figure it out by finding an analagous problem here: https://github.com/flutter/flutter/issues/65334

I added

    buildTypes {
        release {
           minifyEnabled false
           shrinkResources false
    ...

to my build.gradle file. You can also set both of those values to true and run flutter run --release to reproduce the issue locally. When you build with flutter build appbundle it shrinks by default whereas running locally does not, that's why you aren't seeing the issue when running locally. It has something to do with the google sign in code being trimmed. This is really a workaround.




回答2:


add this library in .yaml

google_sign_in: ^0.0.2

then import this in your login screen

import io.flutter.plugins.GeneratedPluginRegistrant;

then add this to the onCreate function

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }


来源:https://stackoverflow.com/questions/65402445/missingpluginexceptionno-implementation-found-for-method-init-on-channel-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!