错误:(13) 错误:元素<receiver>必须是元素 <application> [WrongManifestParent] 的直接子元素是什么意思,我该如何解决它?



我在试图编译我的应用程序时遇到问题,我试图从拨号程序启动它,清单文件收到了这个错误。这是我的清单文件

<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <receiver
            android:name=".receiver.DialReceiver"
            android:exported="true"
            android:process=":background"
            >
            <intent-filter>
                <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>
    </activity>
</application>

移动

 <receiver
        android:name=".receiver.DialReceiver"
        android:exported="true"
        android:process=":background"
        >
        <intent-filter>
            <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>

外部<activity>标签

尝试这样修改您的清单:

<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
    </activity>
    <receiver
        android:name=".receiver.DialReceiver"
        android:exported="true"
        android:process=":background">
        <intent-filter>
            <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
</application>

最新更新