0

当我尝试解决 GCM 问题时,清单文件出现错误:

错误

错误:错误:未找到与给定名称匹配的资源(在“标签”处,值为“@string/title_activity_main”)。

错误出现在这里:

android:label="@string/title_activity_main" >

显现:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.elarabygroup"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <permission
        android:name="com.example.elarabygroup.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.elarabygroup.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <!-- App receives GCM messages. -->
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <!-- GCM connects to Google Services. -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- GCM requires a Google account. -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <!-- Keeps the processor from sleeping when a message is received. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <service
            android:name="com.example.elarabygroup"
            android:enabled="true" />

        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.example.elarabygroup.gcm2" />
            </intent-filter>
        </receiver>
    </application>

</manifest>
4

2 回答 2

0

您应该将字符串res/values/strings.xml作为一个项目:

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

    <string name="title_activity_main">My Main Activity</string>   

</resources>
于 2012-09-09T10:36:36.693 回答
0

请添加@string/title_activity_main到您的字符串资源。

于 2012-09-09T10:37:31.060 回答