SAP / gigya-flutter-plugin

Plugin for easily integrating SAP CDC functionality and flows into your Flutter app.
Apache License 2.0
14 stars 16 forks source link

MissingPluginException(No implementation found for method initSdk on channel com.sap.gigya_flutter_plugin/methods) #83

Open Feelynx opened 1 month ago

Feelynx commented 1 month ago

Checklist

Description

Hi there,

We are experiencing (and had experienced) a recurring issue across multiple projects in our company, all using the same plugin. The error occurs specifically on Android when trying to initialize the Gigya SDK:

I/flutter (15108): Failed to initialize the Gigya SDK.
I/flutter (15108): MissingPluginException(No implementation found for method initSdk on channel 
com.sap.gigya_flutter_plugin/methods)

Key Details

Flutter Doctor

[✓] Flutter (Channel stable, 3.24.3, on macOS 14.3.1 23D60 darwin-arm64, locale it-IT) • Flutter version 3.24.3 on channel stable at /Users/mashfrog/development/flutter • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/mashfrog/Library/Android/sdk • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] Xcode - develop for iOS and macOS (Xcode 15.2) • CocoaPods version 1.15.2

[✓] Android Studio (version 2024.1) [✓] IntelliJ IDEA Community Edition (version 2024.1.3) [✓] VS Code (version 1.93.1)

Solution

Remembering the pubspec.yaml of your example in version 1.0.0 gigya-flutter-plugin-1.0.0.zip, you were implementing the _flutter_facebookauth: ^4.1.2:

name: gigya_flutter_plugin_example
description: Demonstrates how to use the gigya_flutter_plugin plugin.
version: 1.0.0
homepage: https://www.sap.com
publish_to: none

environment:
  sdk: ">=2.18.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  flutter_facebook_auth: ^4.1.2
  gigya_flutter_plugin:
    # When depending on this package from a real application you should use:
    #   gigya_flutter_plugin: ^x.y.z
    # See https://dart.dev/tools/pub/dependencies#version-constraints
    # The example app is bundled with the plugin so we use a path dependency on
    # the parent directory to use the current plugin's version.
    path: ../

  google_sign_in: ^5.2.4

dev_dependencies:
  flutter_lints: ^2.0.0

  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

  assets:
    - assets/

I found that adding the flutter_facebook_auth dependency to the pubspec.yaml resolves the issue. The dependency doesn't seem to be directly related to the Gigya SDK. Actually i cannot understand why this is solving the issue.

Request:

Could anyone provide insights on why adding the flutter_facebook_auth dependency resolves the issue? I would like to better understand the root cause of this. If is it a mandatory dependency to have in our pubspec.yaml why is it not mentioned in the readme guide?

Thank you for your time!

Reproduction

  1. Start a new Flutter Project
  2. Add the dependency gigya_flutter_plugin: ^1.0.7 to your pubspec.yaml
  3. Follow one to one the configuration provided here guide
  4. Init the gygia sdk
  5. Run the app on an android phone or emulator

Additional context

No response

SDK version

1.0.7

Android/iOS

Android

whosjorge23 commented 1 month ago

I encountered the same issue but resolved it using the provided code. Thank you @Feelynx