ApplicationId不能为null

时间:2014-03-09 17:38:24

标签: android xml facebook

我试图在测试中运行这个简单的示例日志,但我总是遇到同样的问题:“applicationId”不能为null。我以前读过问题,但没有人解决我的问题。提前致谢!

的strings.xml:

<string name="app_name">FacebookShareTest</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="app_id">1355*********</string>

的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.facebooksharetest"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-permission android:name="android.permission.INTERNET"/>
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.facebooksharetest.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>
</application>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>


</manifest>

1 个答案:

答案 0 :(得分:1)

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

应位于应用程序标记

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name="com.example.facebooksharetest.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.facebook.sdk.ApplicationId"
            android:value="@string/app_id" />
    </application>
</manifest>