简体   繁体   English

MissingPluginException(在通道 app.meedu/flutter_facebook_auth 上找不到方法登录的实现):Flutter

[英]MissingPluginException(No implementation found for method login on channel app.meedu/flutter_facebook_auth): Flutter

I am trying to use Facebook Authentication in Flutter.我正在尝试在 Flutter 中使用 Facebook 身份验证。 I followed all the steps in proper order as given - https://facebook.meedu.app/docs/4.xx/android我按照给定的正确顺序执行了所有步骤 - https://facebook.meedu.app/docs/4.xx/android
https://developers.facebook.com/docs/facebook-login/android/ But, when I fresh restart my app (as told in many other answers), I still get the error-https://developers.facebook.com/docs/facebook-login/android/但是,当我重新启动我的应用程序(如许多其他答案中所述)时,我仍然得到错误 -

MissingPluginException(No implementation found for method login on channel app.meedu/flutter_facebook_auth) MissingPluginException(在通道 app.meedu/flutter_facebook_auth 上找不到方法登录的实现)

I get this line in the console and no other exception of any type.我在控制台中得到这条线,没有其他任何类型的例外。 That's why I can't figure out where the problem is.这就是为什么我无法弄清楚问题出在哪里。

manifest file-清单文件-

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.social_media_login">
    <queries>
        <provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
        <provider android:authorities="com.facebook.orca.provider.PlatformProvider" /> <!-- allows sharing to Messenger app -->
    </queries>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:label="social_media_login"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
            <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>




        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

pubspec file- pubspec 文件-

name: social_media_login
description: Grip September 2022 Social Media Login in Apps

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.17.6 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  twitter_login: ^4.2.3
  font_awesome_flutter: ^10.1.0
  google_sign_in: ^5.4.1
  flutter_facebook_auth: ^4.4.1
  provider: ^6.0.3
  shared_preferences: ^2.0.15
  flutter_profile_picture: ^2.0.0
  cached_network_image: ^3.2.1
dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - Images/LoginPage/Login Page.jpg
    - Images/HomePage/DefaultProfileImage.jpg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

My dart code-我的 dart 代码-

Future<void> _facebookSignIn() async {
    try {
      final result =
          await FacebookAuth.i.login(permissions: ['public_profile', 'email']);
      if (result.status == LoginStatus.success) {
        final userData = await FacebookAuth.i.getUserData();
        print(userData);
      }
    } catch (error) {
      print(error);
    }

I followed the following articles and documentation- https://pub.dev/packages/flutter_facebook_auth我遵循了以下文章和文档- https://pub.dev/packages/flutter_facebook_auth
https://developers.facebook.com/docs/facebook-login/android/https://developers.facebook.com/docs/facebook-login/android/

Please help me resolve the issue!请帮我解决问题!

I also get this issue sometimes in some plugins but when I uninstall and reinstall it the app.我有时在某些插件中也会遇到这个问题,但是当我卸载并重新安装该应用程序时。

It worked for me.它对我有用。

I ran into the same issue today.我今天遇到了同样的问题。

As it is said on this screenShot, that "Misssing plugin error" is thrown when u dont complete the configuration.正如在此屏幕截图上所说,当您未完成配置时会引发“缺少插件错误”。

You should've miss some steps.你应该错过了一些步骤。

In my case i just forgot adding就我而言,我只是忘了添加

this to AndroidManifest这到 AndroidManifest

```<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>``` 

And this one to string.xml file而这个要string.xml文件

<string name="facebook_client_token">123-THIS-IS-YOUR-CLIENT-TOKEN</string>

Page link页面链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 基于 Flutter 的 Android 应用程序抛出 MissingPluginException(未找到通道上的方法的实现) - Flutter based Android app throwing MissingPluginException(No implementation found for method on channel) Flutter:未处理的异常:MissingPluginException(在通道上找不到方法的实现) - Flutter: Unhandled Exception: MissingPluginException(No implementation found for method on channel) MissingPluginException(在通道 flutter_inapp 上找不到方法 initConnection 的实现) - MissingPluginException(No implementation found for method initConnection on channel flutter_inapp) MissingPluginException(MissingPluginException(在通道 plugins.flutter.io/firebase_core 上找不到方法 Firebase#initializeCore 的实现) - MissingPluginException (MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core) Flutter: android MissingPluginException(找不到方法 getApplicationDocumentsDirectory 的实现) - Flutter: android MissingPluginException(No implementation found for method getApplicationDocumentsDirectory) Flutter MissingPluginException(在通道 flutter.baseflow.com/permissions/methods 上找不到方法 init 的实现) - Flutter MissingPluginException(No implementation found for method init on channel flutter.baseflow.com/permissions/methods) 未处理的异常:MissingPluginException(在频道 plugins.flutter.io/google_mobile_ads 上找不到方法 _init 的实现)in_app_purchase - Unhandled Exception: MissingPluginException(No implementation found for method _init on channel plugins.flutter.io/google_mobile_ads) in_app_purchase MissingPluginException(MissingPluginException(未找到方法 camera#animate on channel plugins.flutter.io/google_maps_53)的实现) - MissingPluginException (MissingPluginException(No implementation found for method camera#animate on channel plugins.flutter.io/google_maps_53)) MissingPluginException(未在通道插件上找到方法 init 的实现。flutter.io/google_sign_in) - MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in) MissingPluginException(在 Android 上找不到方法 Firebase#initializeCore 在通道插件上的实现。flutter.io/firebase_core) - MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core) on Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM