错误:属性" android:name"与元素类型相关联" null"不得包含'<'字符

时间:2016-06-23 12:03:54

标签: android

我是一个试图找出错误的新手。但是,即使多次尝试,我也没有达成任何解决方案。

我正在分享android-manifest.xml文件代码。更多细节在此代码之后。

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".StopwatchActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <meta-data android:name="com.applozic.application.key"
            android:value="API_KEY" /> <!-- Applozic Application Key -->

        <meta-data android:name="com.applozic.mobicomkit.notification.icon"
            android:resource="@drawable/mobicom_ic_launcher" />  <!-- Launcher Icon -->

        <meta-data android:name="com.applozic.mobicomkit.notification.smallIcon"
            android:resource="YOUR_LAUNCHER_SMALL_ICON" /> <!-- Launcher white Icon -->

        <meta-data android:name="share_text"
            android:value="Talk about time!..the essence of life." />  <!-- Invite Message -->

        <meta-data android:name="main_folder_name"
            android:value="@string/default_media_location_folder" /> <!-- Attachment Folder Name -->

        <meta-data android:name="com.google.android.geo.API_KEY"
            android:value="GEO_KEY" />  <!--Replace with your geo api key from google developer console  -->
        <!-- For testing purpose use 
        To disable the location sharing via map add this line ApplozicSetting.getInstance(context).disableLocationSharingViaMap(); in onSuccess of Applozic UserLoginTask -->

        <meta-data android:name="activity.open.on.notification"
            android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" /> <!-- NOTE : Do NOT change this value -->

        <meta-data android:name="com.package.name"
            android:value="${applicationId}" /> <!-- NOTE: Do NOT change this, it should remain same i.e 'com.package.name' -->



        <receiver android:name="com.applozic.mobicomkit.uiwidgets.notification.MTNotificationBroadcastReceiver">
            <intent-filter>
                <action android:name="${applicationId}.send.notification" />
            </intent-filter>
        </receiver>




        <activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:parentActivityName=".StopwatchActivity"
            android:theme="@style/ApplozicTheme"
            android:launchMode="singleTask" >
            <!-- Parent activity meta-data to support API level 7+ -->
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".StopwatchActivity" />
        </activity>

        <activity android:name="com.applozic.mobicomkit.uiwidgets.people.activity.MobiComKitPeopleActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/activity_contacts_list"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/Applozic.People.Theme"
            android:windowSoftInputMode="adjustResize">
            <!-- Parent activity meta-data to support API level 7+ -->
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable_contacts" />
        </activity>

        <activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.FullScreenImageActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="Image"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/Applozic_FullScreen_Theme">
            <!-- Parent activity meta-data to support API level 7+ -->
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
        </activity>

        <activity
            android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ContactSelectionActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:launchMode="singleTop"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/ApplozicTheme">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
        </activity>

        <activity
            android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ChannelCreateActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:launchMode="singleTop"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/ApplozicTheme">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
        </activity>

        <activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ChannelNameActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:launchMode="singleTop"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/ApplozicTheme">
        </activity>

        <activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ChannelInfoActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:launchMode="singleTop"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/ApplozicTheme">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
        </activity>

        <activity
            android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.MobiComAttachmentSelectorActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:launchMode="singleTop"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/ApplozicTheme"
            android:windowSoftInputMode="stateHidden|adjustResize">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
        </activity>

        <activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.MobicomLocationActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
            android:theme="@style/ApplozicTheme"
            android:windowSoftInputMode="adjustResize">
        </activity>


        <service android:name="com.applozic.mobicomkit.api.conversation.MessageIntentService"
            android:exported="false" />

        <service android:name="org.eclipse.paho.android.service.MqttService" />

        <service android:name="com.applozic.mobicomkit.api.conversation.ApplozicIntentService"
            android:exported="false" />

        <service android:name="com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService"
            android:exported="false" />

        <receiver android:name="com.applozic.mobicomkit.broadcast.TimeChangeBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.TIME_SET" />
                <action android:name="android.intent.action.TIMEZONE_CHANGED" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.applozic.mobicomkit.broadcast.ConnectivityReceiver"
            android:exported="true" android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="<APP_PKG_NAME>" />
            </intent-filter>
        </receiver>
        <service android:name=".pushnotification.ApplozicGcmListenerService">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>
        <service android:name=".pushnotification.GcmInstanceIDListenerService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.gms.iid.InstanceID" />
            </intent-filter>
        </service>

    </application>

    <uses-permission android:name="com.example.home.timestopper.pushnotification.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.example.home.timestopper.pushnotification.permission.MAPS_RECEIVE" />
    <permission android:name="com.example.home.timestopper.pushnotification.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <permission android:name="com.example.home.timestopper.pushnotification.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"  />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />



    </manifest>

所以,我在这里要做的是将聊天功能集成到我刚刚为学习目的创建的小型时间限制应用程序中,我也将其集成用于学习目的。

当我构建gradle时,Result显示错误:属性的值&#34; android:name&#34;与元素类型相关联&#34; null&#34;不得包含&#39;&lt;&#39;字符。

错误:无法从C:\ Users \ APnaturals \ AndroidStudioProjects \ TimeStopper \ app \ src \ main \ AndroidManifest.xml

读取packageName

当我将APP_PKG_NAME替换为此处提到的

  

manifest xmlns:android =&#34; http://schemas.android.com/apk/res/android"       包=&#34; com.example.home.timestopper&#34;

Gradle Build再次失败,没有任何原因。

2 个答案:

答案 0 :(得分:4)

 <category android:name="<APP_PKG_NAME>" />

您似乎忘了在此元素中配置您的包名称。

答案 1 :(得分:0)

仅从元数据中删除APP_PKG_NAME并放入您的包名称或ID,如 androidmanifest.xml 中不允许<>一样。