Gradle throw app:mergedebugresources exception

时间:2016-12-18 11:24:59

标签: android android-studio android-gradle

此项目以前来自intellij,现在作为Gradle android项目迁移到android studio。 我希望稍后使用gradle添加google play服务依赖项,我无法在其他地方找到特定的jar ... 以前这个项目使用ant运行正常,在android studio中作为gradle导入后,我得到了Gradle mergedebugresources异常。

我尝试重建项目,使用gradle文件同步项目,但对我没有用...我错过了什么?

希望有人指导我,我是Gradle& amp;的新手。 android studio。

  

执行任务:[:应用程序:generateDebugSources,:应用程序:mockableAndroidJar,:应用程序:prepareDebugUnitTestDependencies,:应用程序:generateDebugAndroidTestSources]

     

按需配置是一项孵化功能。   增量java编译是一个孵化功能。   :app:preBuild UP-TO-DATE   :app:preDebugBuild UP-TO-DATE   :应用:checkDebugManifest   :应用:prepareDebugDependencies   :app:compileDebugAidl UP-TO-DATE   :app:compileDebugRenderscript UP-TO-DATE   :app:generateDebugBuildConfig UP-TO-DATE   :app:generateDebugResValues UP-TO-DATE   :app:generateDebugResources UP-TO-DATE   :应用:mergeDebugResources   错误:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:   :app:mergeDebugResources FAILED

     

失败:构建因异常而失败。

     
      
  • 出了什么问题:   任务':app:mergeDebugResources'执行失败。   错误:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:

  •   
  • 尝试:   使用--info或--debug选项运行以获得更多日志输出。

  •   
  • 例外情况是:   org.gradle.api.tasks.TaskExecutionException:任务':app:mergeDebugResources'执行失败。   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)   在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)   在org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)   在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)   在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)   在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)   在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)   在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)   在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)   在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)   在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)   at org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)   at org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)   在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)   在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)   在org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)   在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)   在org.gradle.execution.DefaultBuildExecuter.access $ 000(DefaultBuildExecuter.java:23)   在org.gradle.execution.DefaultBuildExecuter $ 1.proceed(DefaultBuildExecuter.java:43)   在org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)   在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)   在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)   在org.gradle.initialization.DefaultGradleLauncher $ 4.run(DefaultGradleLauncher.java:153)   在org.gradle.internal.Factories $ 1.create(Factories.java:22)   在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)   在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)   在org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)   在org.gradle.initialization.DefaultGradleLauncher.access $ 200(DefaultGradleLauncher.java:32)   在org.gradle.initialization.DefaultGradleLauncher $ 1.create(DefaultGradleLauncher.java:98)   在org.gradle.initialization.DefaultGradleLauncher $ 1.create(DefaultGradleLauncher.java:92)   在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)   在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)   在org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)   在org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)   at org.gradle.launcher.exec.InProcessBuildActionExecuter $ DefaultBuildController.run(InProcessBuildActionExecuter.java:99)   在org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)   在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)   在org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)   在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)   at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)   在org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)   在org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)   在org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)   在org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)   在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:74)   在org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:72)   在org.gradle.util.Swapper.swap(Swapper.java:38)   在org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)   在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)   在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)   在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)   在org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy $ 1.run(StartBuildOrRespondWithBusy.java:50)   在org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run(DaemonStateCoordinator.java:237)   at org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)   at org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run(StoppableExecutorImpl.java:40)   引起:com.android.build.gradle.tasks.ResourceException:错误:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:   在com.android.build.gradle.tasks.MergeResources.doFullTask​​Action(MergeResources.java:161)   在com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction(IncrementalTask​​.java:88)   在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)   at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ IncrementalTask​​Action.doExecute(AnnotationProcessingTaskFactory.java:245)   在org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)   at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ IncrementalTask​​Action.execute(AnnotationProcessingTaskFactory.java:232)   at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)   在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)   ......还有70多个   引起:错误:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:   在com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:268)   在com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:301)   在com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:410)   在com.android.build.gradle.tasks.MergeResources.doFullTask​​Action(MergeResources.java:154)   ......还有78个   引起:java.util.concurrent.ExecutionException:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:   在com.google.common.util.concurrent.AbstractFuture $ Sync.getValue(AbstractFuture.java:299)   在com.google.common.util.concurrent.AbstractFuture $ Sync.get(AbstractFuture.java:286)   在com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)   在com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:264)   ......还有81个   引起:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:   在com.google.common.util.concurrent.AbstractFuture $ Sync.getValue(AbstractFuture.java:299)   在com.google.common.util.concurrent.AbstractFuture $ Sync.get(AbstractFuture.java:286)   在com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)   在com.android.builder.internal.aapt.v1.AaptV1.lambda $ compile $ 0(AaptV1.java:446)   引起:com.android.ide.common.process.ProcessException:   在com.android.builder.png.AaptProcess $ NotifierProcessOutput.out(AaptProcess.java:284)   在com.android.builder.png.AaptProcess $ ProcessOutputFacade.out(AaptProcess.java:215)   在com.android.utils.GrabProcessOutput $ 2.run(GrabProcessOutput.java:143)

  •   
     

建立失败

     

总时间:2.273秒

我的项目文件结构如下:

a busy cat

感谢任何建议或指导。 非常感谢。

3 个答案:

答案 0 :(得分:6)

很抱歉更新我的回答。 实际上发现的是9个具有错误格式的补丁图像,一个9补丁图像没有在最外面画出黑色的角线。 我粗心的错误!真的使用photoshop不合适制作9补丁图像! 以前的蚂蚁项目没有注意到这个问题。

现在使用Gradle进行适当的检查并抛出异常。 但是,日志消息确实对调试没有帮助!

答案 1 :(得分:0)

使用Android Studio 2.2.3时遇到同样的问题。

但是我将项目导入CVS存储库后出现此错误。 我尝试了一个新的空虚项目。

到目前为止我发现了什么

  • PNG文件默认被视为文本文件(0d,0a转换),再次签出时是垃圾,尝试使用内置一个PNG文件的新项目,所以永远不要导入带有现有PNG的新项目,添加它们在第一次导入后能够指定其类型。
  • 导入CVS后,\ build \ intermediates \ incremental \ mergeDebugResources中的merger.xml文件将被删除。即使我将原始merger.xml复制到文件夹中,构建也不起作用。启动构建后,将再次删除merger.xml文件。

嘿,这里发生了什么,使用IDE 2.2.3版本应该不存在这样的元素问题?

答案 2 :(得分:0)

我的GRADLE_HOME路径遇到了相同的问题,该路径包含非英语字符(“ó”),并且它是用户的家默认目录/.gradle。解决方案是在“设置”->“构建,执行,部署”->“ Gradle”中更改Gradle的Service目录路径,以使其不包含非英文字符,例如:

Gradle setting that caused the problem