Android facebook applicationId cannot be null error despite correct app_id
Asked Answered
V

1

6

I know this question has been asked before, but my problem is that I have set up the Manifest and Strings files correctly:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hellofb"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.hellofb.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

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

        <activity android:name="com.hellofb.LoginActivity" />
    </application>

</manifest>

(app_id string edited for security)

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Hello FB</string>
    <string name="action_settings">Settings</string>
    <string name="hello_world">Hello world!</string>
    <string name="app_id">18031830547XXXX</string>

</resources>

Any ideas where I might be going wrong? Have I by any chance set things up the wrong way? Any help in the right direction is appreciated.

Virtual answered 14/7, 2013 at 15:46 Comment(0)
F
7

You are doing it wrong. It should be like below:

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

You should not alter the name string.

Fishbein answered 14/7, 2013 at 16:45 Comment(3)
Wow, thanks a lot! So I guess this value is being set for the SDK library rather than the current project.Virtual
Yes exactly. Facebook SDK is getting the application id from this meta. So the name should not be changed.Fishbein
Thank you. You have delivered me from a day-long headache. :)Virtual

© 2022 - 2024 — McMap. All rights reserved.