Android facebook applicationId cannot be null

TL;DR: you have to write your application’s ID in your strings.xml and then reference (i.e. @strings/fb_app_id), because if you put it directly (as value) into AndroidManifest.xml it won’t work.

you must define your applicationId in the AndroidManifest.xml
like this:

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>

under <application android:label="@string/app_name".... tag

where app_id is a string within your strings.xml.


sample:

 <application android:label="@string/app_name"
                 android:icon="@drawable/icon"
                 android:theme="@android:style/Theme.NoTitleBar"
            >
        <activity android:name=".HelloFacebookSampleActivity"
                  android:label="@string/app_name"
                  android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.LoginActivity"
                  android:theme="@android:style/Theme.Translucent.NoTitleBar"
                  android:label="@string/app_name" />
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
    </application>

** please note <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/> is within <application> tag

— and in strings.xml

<string name="app_id">1389xxxxxxxx</string>

Leave a Comment