Reputation: 19
I've followed everything on the tuturial connnecting to facebook, but I've been still getting applicationId cannot be null.
The login button:
<com.facebook.login.widget.LoginButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
Android manifiest:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyMaterialTheme.Base" >
<activity
android:name=".LoadingActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/app_id"/>
strings.xml:
<string name="app_id">1122************</string>
LoadingActivity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
CallbackManager callbackManager = CallbackManager.Factory.create();
setContentView(R.layout.activity_loading);
addControl();
startLoading();
}
Error:
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:911)
at com.facebook.internal.Utility.queryAppSettings(Utility.java:825)
at com.facebook.login.widget.LoginButton$1.run(LoginButton.java:489)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Upvotes: 1
Views: 223
Reputation: 459
I've just ran into the same issue, move the meta-data line inside the application tag instead the activity tag, otherwise the Facebook SDK won't be able to read it.
Upvotes: 1