尽管app_id正确,但Android facebook applicationId不能为null错误

时间:2013-07-14 15:46:39

标签: android android-facebook

我知道之前已经问过这个问题,但我的问题是我已经正确设置了Manifest和Strings文件:

<?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字符串)

<?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>

我可能会出错的任何想法?我有没有机会设置错误的方法?我们赞赏任何正确方向的帮助。

1 个答案:

答案 0 :(得分:7)

你做错了。它应该如下所示:

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

您不应该更改名称字符串。