【问题标题】:What does Error:(13) Error: The <receiver> element must be a direct child of the <application> element [WrongManifestParent] mean and how do i fix it?Error:(13) Error: The <receiver> element must be a direct child of the <application> element [WrongManifestParent] 是什么意思,我该如何解决?
【发布时间】:2015-02-19 11:06:01
【问题描述】:

我在尝试编译我的应用程序时遇到问题,我尝试从拨号程序启动它,并且清单文件出现此错误。这是我的清单文件

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

【问题讨论】:

    标签: android android-intent broadcastreceiver


    【解决方案1】:

    移动

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

    &lt;activity&gt;标签外

    【讨论】:

    • 当我这样做时 android:name=".receiver.DialReceiver" 变成一个错误
    • 无法解析符号接收器,也无法解析符号DialReceiver
    【解决方案2】:

    尝试像这样修改您的清单:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-06
      • 1970-01-01
      • 2020-09-06
      • 2020-05-13
      • 2021-07-18
      • 2019-12-05
      • 1970-01-01
      • 2013-09-30
      相关资源
      最近更新 更多