oddbit / flutter_facebook_app_events

Flutter Plugin for Facebook App Events
https://pub.dev/packages/facebook_app_events
Apache License 2.0
129 stars 327 forks source link

[Bug]: Android: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. #381

Closed byronics closed 2 weeks ago

byronics commented 1 month ago

Is there an existing issue for this?

Current Behavior

  1. Install facebook_app_events: ^0.19.3 and configure Android manifest as documented with facebook_app_id and facebook_client_token
  2. Implement provider with calls to .setUserID(uid) and .clearUserID() on login and logout respectively
  3. Test login and logout in app
  4. E/MethodChannel#flutter.oddbit.id/facebook_app_events(11223): The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
  5. Process fails

Expected Behavior

Expected that the plugin would initialize the Facebook SDK

Steps To Reproduce

  1. Install facebook_app_events: ^0.19.3 and configure Android manifest as documented with facebook_app_id and facebook_client_token
  2. Implement provider with calls to .setUserID(uid) and .clearUserID() on login and logout respectively
  3. Test login and logout in app

Platform

Android

Flutter Doctor

[✓] Flutter (Channel stable, 3.7.7, on macOS 14.6.1 23G93 darwin-arm64, locale en-US)
    • Flutter version 3.7.7 on channel stable at /Users/byron/Development/Packages/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2ad6cd72c0 (1 year, 8 months ago), 2023-03-08 09:41:59 -0800
    • Engine revision 1837b5be5f
    • Dart version 2.19.4
    • DevTools version 2.20.1

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/byron/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.94.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 14 (API 34) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 14.6.1 23G93 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 130.0.6723.59

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 5 days.

antonoddbit commented 3 weeks ago

@byronics We will investigate this issue, previously we don't have any bugs similar like this issue. There is several closed similar issue due to wrong setup: https://github.com/oddbit/flutter_facebook_app_events/issues/332 https://github.com/oddbit/flutter_facebook_app_events/issues/186

byronics commented 3 weeks ago

@antonoddbit Ok, thanks. I will update the position of the meta tags in my manifest and test. Thanks for the info.

byronics commented 1 week ago

FYI, moving the meta tags into the <application> section solved the problem.