darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
193 stars 127 forks source link

Error registering plugin flutter_facebook_auth #348

Closed BFELFISH closed 11 months ago

BFELFISH commented 11 months ago

What version are you using?

flutter_facebook_auth:3.5.7

What OS and version are you using to local deploy your application?

MacOs 11.5

What platforms are you seeing the problem on?

Android

pubspec.yaml

name: flutter_facebook_auth
description: The easiest way to add facebook login to your flutter app, get user information, profile picture and more. Web support included.
version: 3.5.7
homepage: https://github.com/darwin-morocho/flutter-facebook-auth

environment:
  sdk: ">=2.12.0 <3.0.0"
  flutter: ">=2.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_facebook_auth_platform_interface: ^2.7.1
  # flutter_facebook_auth_platform_interface:
  #   path: ../facebook_auth_platform_interface
  flutter_facebook_auth_web: ^2.6.0+2
  # flutter_facebook_auth_web:
  #   path: ../facebook_auth_web

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  plugin:
    platforms:
      android:
        package: app.meedu.flutter_facebook_auth
        pluginClass: FlutterFacebookAuthPlugin
      ios:
        pluginClass: FlutterFacebookAuthPlugin
      web:
        default_package: flutter_facebook_auth_web

Describe the Bug

I make my MainActivity which extends FlutterActivity as a child process,when MainActivity call super.configureFlutterEngine(flutterEngine), get the error Error registering plugin flutter_facebook_auth, app.meedu.flutter_facebook_auth.FlutterFacebookAuthPlugin The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. at com.facebook.internal.Validate.sdkInitialized(Validate.kt:129) at com.facebook.FacebookSdk.getApplicationContext(FacebookSdk.kt:632) at app.meedu.flutter_facebook_auth.FacebookAuth.<init>(FacebookAuth.java:31) at app.meedu.flutter_facebook_auth.FlutterFacebookAuthPlugin.<init>(FlutterFacebookAuthPlugin.java:20) at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:114) at java.lang.reflect.Method.invoke(Native Method) at io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister.registerGeneratedPlugins(GeneratedPluginRegister.java:80) at io.flutter.embedding.android.FlutterActivity.configureFlutterEngine(FlutterActivity.java:1133) at com.quyue.ttchat.MainActivity.configureFlutterEngine(MainActivity.kt:136) at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:206) at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:495) at com.quyue.ttchat.MainActivity.onCreate(MainActivity.kt:126) at android.app.Activity.performCreate(Activity.java:8488) at android.app.Activity.performCreate(Activity.java:8461) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1343) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4602) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4842) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:113) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2928) at android.os.Handler.dispatchMessage(Handler.java:117) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:293) at android.app.ActivityThread.main(ActivityThread.java:9596) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:586) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1204)

But if i make MainActivity as main process,it works fine. So how can i regist flutter_facebook_auth on child process.

Expected Behavior

I want to regist flutter_facebook_auth on child process.My main process is a native Activity names LaunchActivity,and i startActivity(new Intent(this,MainActivity.class)) immediately in LaunchActivity onCreate.

To Reproduce

create a Flutter project. make LuanchActivity like ` <activity android:name=".LaunchActivity" android:exported="true" android:noHistory="true" android:process="con.example.main" android:theme="@style/LaunchTheme">

    </activity>`

MainActivity ` <activity android:name=".MainActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:exported="true" android:hardwareAccelerated="true" android:launchMode="singleTask" android:process="con.example.child" android:screenOrientation="portrait" android:theme="@style/LaunchTheme" android:windowSoftInputMode="adjustResize"> <meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />

        <!--                android:name="io.flutter.embedding.android.SplashScreenDrawable"-->
        <!--                android:resource="@drawable/launch_background" />-->

        <intent-filter>
            <action android:name="FLUTTER_NOTIFICATION_CLICK" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.example.action" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

        <intent-filter>
            <action android:name="${applicationId}.xxx.action" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
            <data
                android:host="xxx"
                android:scheme="xxx" />
        </intent-filter>
    </activity>`

then run startActivity(new Intent(this,MainActivity)) in LaunchActivity onCreate()

Relevant log output

No response

flutter doctor -v

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.12, on macOS 11.5 20G71 darwin-arm64 (Rosetta), locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio
    ✗ Unable to find bundled Java version.
[✓] Android Studio (version 4.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

Info.plist (iOS)

No response

Podfile (iOS)

No response

AndroidManifest.xml

No response

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

darwin-morocho commented 11 months ago

I am closing this due to the report is not filled on the right way