Facebook Sdk Has Not Been Initialized FacebookSdk.sdkInitialize()
You don't need to use FacebookSdk.sdkInitialize anymore. Check if your:
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
is inside <application>
tag.
You have to use FacebookSdk.sdkInitialize(getApplicationContext());
before setContentView(R.layout.activity_main);
as documentation states out. In case you need a complete facebook login example, check this one here.
Problem
While integrating Android SDK for a react-native project, I had finished the Android with React Native v0.30+ Project Configuration guide, and ran react-native run-android
and then got this screen:
I learned that FacebookSdk.sdkInitialize
is deprecated. see here
After some searching, I realized that the guide did not contain the steps to add the Facebook App ID for my app.
Solution
Open
android/app/src/main/AndroidManifest.xml
file and look in the<application>
tag to confirm that thismeta-data
tag exists:<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
Open
android/app/src/main/res/values/strings.xml
file and confirm that this there is a "facebook_app_id" string tag with your app id as the value:<string name="facebook_app_id">YOUR_APP_ID_HERE</string>
Run
react-native run-android
.
These are the steps that worked for me.