手把手教你轻松解决Error:java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs

这可谓经典错误了,
Manifest merger failed
的意思是清单文件合并错误,首先是可以定位AndroidManifest.xml文件了。
错误等级 高
因为错误不明显,所以解决起来貌似非常困难
对于新手来说就是太浮躁,不仔细看错误就会忽略这些错误细节,ok 我这次静下心来分析了一把
点击gradle console

image.png
        ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:78:13-36
    android:name
        ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:76:13-66
intent-filter#${JPUSH_PKGNAME}+cn.jpush.android.intent.DaemonService
ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:79:13-83:29
intent-filter#cn.jpush.android.intent.DaemonService+com.buyao.tv
ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:79:13-83:29
action#cn.jpush.android.intent.DaemonService
ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:80:17-80
    android:name
        ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:80:25-77


//之后是红色文字日志
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:app:processDebugManifest FAILED
:app:processDebugManifest (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.738 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:61)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
    at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:517)
    at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:143)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 30 more


* Get more help at https://help.gradle.org

BUILD FAILED in 1m 22s

233 actionable tasks: 221 executed, 12 up-to-date


The build scan was not published due to a configuration problem.

The Gradle Cloud Services license agreement has not been agreed to.

从红色日志可以看出来之前是处理了jpush,可以看出来可能是某些东西已经添加了,但是发现jiguagnpush里面也有。
从上面的错误可以发现是添加了这个

   android:name
        ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:80:25-77

进去导致的错误
打开文件

 C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:80:2

找到80行

  <service
            android:name="cn.jpush.android.service.DaemonService"
            android:enabled="true"
            android:exported="true" >
            <intent-filter>
                <action android:name="cn.jpush.android.intent.DaemonService" />

                <category android:name="${JPUSH_PKGNAME}" />
            </intent-filter>
        </service>

ok,看下图,那么看看自己的项目是否也添加了,解决方法就是删除就ok,所以总结就是有时候不需要自己再配置了,我是因为收不到自定义广播才怀疑是不是这些东西没添加导致的,谁知道坑死,原来是host忘记改了

image.png

另外如果你的gradle没有这么详细的错误
打开Android Studio 设置
Compiler->Comand line Options:
--stacktrace --info --scan

如下图所示


image.png

发现问题远没那么简单

eceiver#cn.jpush.android.service.AlarmReceiver
ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:110:9-112:40
    android:exported
        ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:112:13-37
    android:name
        ADDED from [cn.jiguang.sdk:jpush:3.0.5] C:\speed\other\.gradle\caches\transforms-1\files-1.1\jpush-3.0.5.aar\be57b9ec491b0e03a84674b5c983513d\AndroidManifest.xml:111:13-66


See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

All input files are considered out-of-date for incremental task ':sharesdk:generateDebugRFile'.
Unable do incremental execution: full task run
:app:processDebugManifest FAILED
:app:processDebugManifest (Thread[Task worker for ':',5,main]) completed. Took 0.329 secs.
:pulltorefresh_library:generateDebugRFile (Thread[Daemon worker Thread 4,5,main]) completed. Took 0.277 secs.
:sharesdk:generateDebugRFile (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.204 secs.
:IMKit:packageDebugResources (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 3.21 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:61)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
    at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:517)
    at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:143)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 30 more


* Get more help at https://help.gradle.org

BUILD FAILED in 18s

113 actionable tasks: 110 executed, 3 up-to-date


The build scan was not published due to a configuration problem.

The Gradle Cloud Services license agreement has not been agreed to.

To agree to the license, include the following in your root project's configuration:
buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service'; licenseAgree = 'yes' }

For more information, please see https://gradle.com/scans/help/plugin-license.

Alternatively, if you are using Gradle Enterprise, specify the server location.
For more information, please see https://gradle.com/scans/help/plugin-enterprise-config.


那么这次发现这种方法不行了,因为这里可以看出来:IMKit:packageDebugResources (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 3.21 secs后面排除来的错误,
,然而那个地方基本上可以排除,ok使出杀手锏分析logs.txt文件

Help-Show logs


image.png

打开文件分析错误 根据时间显示 最下面的日志才是最靠上的信息。


image.png

我这里的解决方法是删除如下代码

   <meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
        <meta-data android:name="JPUSH_APPKEY" android:value="${JPUSH_APPKEY}" /> 

如果你看完勒,那么这句话
Manifest merger failed with multiple errors see logs 说的不是看idea.log,而是控制台中的红色错误信息,在错误位置往上翻看就能找到关键信息

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 106,392评论 12 127
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 38,112评论 5 340
  • JMETER中文手册 1. 简介 Apache JMeter是100%纯java桌面应用程序,被设计用来测试客户端...
    捉虫师阅读 17,609评论 0 24
  • 1、 块级元素和行内元素分别有哪些?动手测试并列出4条以上的特性区别 块级元素(block-level)div h...
    kumabearplus阅读 37评论 0 0
  • “诗仙”李白是怎样的存在呢?李宗伟的歌“如果能重来,我要选李白,做诗也能让千百年后人缅怀。”是的,想到李白你一定会...
    古诗扑克歌留多阅读 119评论 0 0