You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio Manifest合并错误求助:processDebugManifest执行失败

Hey there, let's fix that annoying Manifest merger error you're hitting in Android Studio. First up, the error message tells you to check the logs—and that's actually the first step you should take to get precise details, but I already spotted a clear issue in your provided manifest that's likely causing the problem.

解决Manifest Merger Failed错误的分步方案

1. 先获取详细错误日志

Android Studio hides the full conflict details by default, so let's dig them up:

  • Switch to the Gradle Console tab in the bottom panel, then click Build -> Rebuild Project. The console will output exact conflict points like duplicate components, permission clashes, or SDK mismatches.
  • Alternatively, you can directly open the file app/build/outputs/logs/manifest-merger-debug-report.txt—it contains a full breakdown of the manifest merging process, which will pinpoint every issue.

2. 修复你Manifest里的明确重复服务问题

Looking at your AndroidManifest.xml, I immediately noticed you've registered the same Firebase service class twice:

<service android:name="com.app.jmbnewsonline.Services.FirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="com.app.jmbnewsonline.Services.FirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>

You can't register the same service class twice in the manifest—it's a direct conflict. Here's how to fix it:

情况1:同一个类处理两个事件

If your FirebaseInstanceIDService class is designed to handle both events, merge the intent filters into one service tag:

<service android:name="com.app.jmbnewsonline.Services.FirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>

情况2:两个不同的服务类

If you have separate classes for messaging and instance ID updates (e.g., a FirebaseMessagingService subclass and a FirebaseInstanceIdService subclass), register them separately:

<!-- Handle push messages -->
<service android:name="com.app.jmbnewsonline.Services.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<!-- Handle instance ID updates -->
<service android:name="com.app.jmbnewsonline.Services.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>

3. 排查其他潜在冲突(如果修复后仍报错)

If the error persists after fixing the duplicate service, use the detailed logs to check these common issues:

  • Duplicate permissions/components: Check if any dependency libraries have registered the same activities, services, or permissions as your manifest.
  • SDK version mismatches: Verify that your build.gradle's compileSdkVersion and targetSdkVersion match the requirements of your dependencies.
  • Property conflicts: If different manifests set conflicting values for application properties (like allowBackup or theme), use the tools:replace attribute to force your manifest's value. First add the tools namespace to your root manifest tag:
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        ...>
    
    Then add the replace attribute to the conflicting component, e.g.:
    <application
        ...
        android:theme="@style/AppTheme"
        tools:replace="android:theme">
    

4. Verify the fix

After making changes, click Build -> Clean Project, then Build -> Rebuild Project to check if the error is resolved.


内容的提问来源于stack exchange,提问作者Megha Jain

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:19:33