facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 907 forks source link

Native Module FBAccessToken tried to override FBAccessTokenModule #618

Closed yanguyt closed 5 years ago

yanguyt commented 5 years ago

🐛 Bug Report

I'm trying to use Facebook login on my app, but when i try to run my application on Android i receive this message. When i go to my mainApplication.java to see if there is something duplicated, everything looks alright. By the way, on IOS it's working.

my config is "react": "16.8.6", "react-native": "0.60.4", "react-native-fbsdk": "^1.0.1", "react-native-firebase": "~5.5.6"

Captura de Tela 2019-08-06 às 17 34 19

@Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      // packages.add(new MyReactNativePackage());
      packages.add(new RNFirebaseNotificationsPackage());
      packages.add(new RNFirebaseMessagingPackage());
      packages.add(new FBSDKPackage());
      return packages;
    }
janicduplessis commented 5 years ago

I think you need to remove the packages.add(FBSDKPackage) line. The package should work with autolinking and doesn’t need to be included manuallly.

mmoonn2 commented 5 years ago

@janicduplessis Remove the packages.add(FBSDKPackage) line Error The sdk has not been initialized make sure to call facebooksdk.sdkinitialize

Rutheniceye92 commented 5 years ago

Had the same issue. had no duplicates in mainapplication file. Solved it by removing the packages.add(new FBSDKPackage()) line. just like @janicduplessis suggested because that module was already being returned by getPackages() method. That's why it was being added again.

akhzarna commented 3 years ago

Remove the packages.add(FBSDKPackage) line Error The sdk has not been initialized make sure to call facebooksdk.sdkinitialize