Search code examples
react-nativeexpofacebook-sdk-4.0

Facebook.SDK not been initialized error in Expo Management App and expo/auth/session


I have an expo managed app that when I run in the production build, I getting the following error.

The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.

So I added Facebook.initializeAsync('MyAppId') to the App.js file and I added the facebookAutoInitEnabled: true in the app.json file. It is a expo managed app, so I don't have access to the android native files before build time. Also, the app works for Facebook login when using the app in a simulator.

I followed this tutorial to setup Facebook login, in my app: https://derk-jan.com/2020/05/expo-facebook-login

Can somebody tell me how to properly make sure the Facebook SDK is initialized.


Solution

  • You should add the

    facebookAutoInitEnabled: true and facebookAppId: 'MyFacebookAppId'

    set in the app.json