简体   繁体   English

错误:任务“:app:mergeDebugResources”执行失败。 > 某些文件处理失败,请参阅日志了解构建 gradle 问题的详细信息

[英]Error:Execution failed for task ':app:mergeDebugResources'. > Some file crunching failed, see logs for details build gradle issues

currently I am using Android Studio 2.1 when I run my App it shows me some error in Message Gradle Build saying the following目前,当我运行我的应用程序时,我正在使用 Android Studio 2.1,它在 Message Gradle Build 中显示了一些错误,内容如下

 Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72221Library
:app:prepareComAndroidSupportDesign2221Library
:app:prepareComAndroidSupportSupportV42221Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
AAPT err(Facade for 114461397): libpng error: Read Error
*Error:Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details*
Information:BUILD FAILED
Information:Total time: 24.87 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

I tried cleaning and rebuilding it but it didn't work.我尝试清洁和重建它,但没有奏效。 The answer for this question didn't work also. 这个问题的答案也不起作用。 Any help would be appreciated, thanks.任何帮助将不胜感激,谢谢。

Updated: Here is the log output更新:这是日志输出

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46
)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskEx
ecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExec
uter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.j
ava:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.j
ava:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecute
r.java:203)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecute
r.java:185)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecut
or.java:66)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:
50)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter
.java:94)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
        at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExe
cuter.java:51)
        at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExe
cuter.java:28)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:23
7)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:21
0)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.RuntimeException: Some file crunching failed, see logs for details
        at com.android.builder.png.QueuedCruncher.waitForAll(QueuedCruncher.java:260)
        at com.android.builder.png.QueuedCruncher.end(QueuedCruncher.java:280)
        at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:132)
        at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:295)
        at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:405)
        at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:178)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:88)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(A
nnotationProcessingTaskFactory.java:244)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(Annota
tionProcessingTaskFactory.java:220)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(Ann
otationProcessingTaskFactory.java:231)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(Annota
tionProcessingTaskFactory.java:209)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.j
ava:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:61)
        ... 57 more

In the individual apps's build.gradle, section android {} , insert :在各个应用的 build.gradle 部分android {}中,插入:

aaptOptions {  
    cruncherEnabled = false  
}  

Reference参考

All problem was a crashed png image in one of my drawable folders.所有问题都是我的一个可绘制文件夹中的一个崩溃的 png 图像。 I mean the images which we sometime face in windows photo viewer, like the one below:我的意思是我们有时在 Windows 照片查看器中面对的图像,如下图所示: 在此处输入图像描述

I dropped the image from the folder and all problem got solved.我从文件夹中删除了图像,所有问题都解决了。

Actually, image file something wrong.实际上,图像文件有问题。 Go to ( drawable ) and remove image or replace with new image.This will solve problem.转到( drawable )并删除图像或替换为新图像。这将解决问题。

In addition, you can put method in ( build.gradle ), but This will not solve the problem but good way to catch up what was wrong.此外,您可以将方法放入( build.gradle ),但这并不能解决问题,但却是弥补错误的好方法。

In build.gradle , section android {} , insert (cruncherEnagle = false)apptOptions .build.gradle部分android {}中, insert (cruncherEnagle = false)apptOptions

Try running gradle from command line:尝试从命令行运行 gradle:

gradle clean build --debug

And post your log afterwards.然后发布您的日志。

Just check this link - Android Studio - mergeDebugResources exception and libpng error: Not a PNG file Error Showing In Android Studio只需检查此链接 - Android Studio - mergeDebugResources 异常libpng 错误:Not a PNG file Error Showing In Android Studio

You can try this command as well sudo apt-get install lib32stdc++6 on the console if you are working on a linux machine, then restart android studio and run your project如果您在 linux 机器上工作,您也可以在控制台上尝试此命令 sudo apt-get install lib32stdc++6,然后重新启动 android studio 并运行您的项目

For me, it was a corrupted PNG file.对我来说,这是一个损坏的 PNG 文件。 Go to your res folder and try to open every images.转到您的res文件夹并尝试打开每个图像。

I was facing the same issue checked all the related answer but my problem was not solved.我面临同样的问题检查了所有相关的答案,但我的问题没有解决。 I added a new folder drawable to add icons in my app.我添加了一个可绘制的新文件夹以在我的应用程序中添加图标。 So after deleting that folder my problem was resolved.因此,删除该文件夹后,我的问题得到了解决。 Also, clean the Gradle your problem will be resolved.此外,清理 Gradle 您的问题将得到解决。

cd android && gradlew clean
cd .. && react-native run-android

Also, there may be some data which is corrupted like images you have added, try to remove those images may it work.此外,可能有一些数据已损坏,例如您添加的图像,尝试删除这些图像可能会起作用。

compress the project file and delete prjct.压缩项目文件并删除prjct。 and extract it and open并提取并打开

In my res folder I created a 9PNG file.在我的 res 文件夹中,我创建了一个 9PNG 文件。 After deleting this file everthing is working fine.删除此文件后一切正常。

  1. Browse Through Your Project Manifest and Resource Files to see if there is an error in the Images you are using.浏览您的项目清单和资源文件以查看您使用的图像中是否存在错误。 (I was missing the roundLauncherIcon). (我错过了roundLauncherIcon)。
  2. Check if all the images that you are using are actually existing.检查您使用的所有图像是否实际存在。

For me, I was getting this error because the full path to the folder was longer than allowed by Windows.对我来说,我收到了这个错误,因为文件夹的完整路径比 Windows 允许的长。 I moved my build to a shallower path and this error went away.我将构建移至较浅的路径,并且此错误消失了。

Related question: Android Studio 2.2 Google play services sync Error相关问题: Android Studio 2.2 Google play services sync Error

On react native在本机反应

When you're inside your project directory try using :当您在项目目录中时,请尝试使用:

$ cd android && gradlew clean $ cd android && gradlew clean

$ cd .. && react-native run-android $ cd .. && react-native run-android

I have the same error too.我也有同样的错误。 But it has fixed now.但它现在已经修复了。

The main problem is some Gradle files are corrupted.主要问题是一些 Gradle 文件已损坏。 I have deleted entire .gradle file and run the project again.我已经删除了整个 .gradle 文件并再次运行该项目。 This time it got worked!.这次成功了!

When I run after deleting .gradle file, it automatically repaired the Gradle files as shown below:当我删除 .gradle 文件后运行时,它会自动修复 Gradle 文件,如下所示:

LOG IN DEBUG CONSOLE:登录调试控制台:

This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.

 **Example of androidX reference: 'androidx/annotation/NonNull'
 Example of support library reference: 'android/support/annotation/NonNull'**

√ Built build\app\outputs\flutter-apk\app-debug.apk.

Installing build\app\outputs\flutter-apk\app.apk...

Waiting for RMX1921 to report its views...

Debug service listening on ws://127.0.0.1:56754/iCJTNoGKPFA=/ws

Syncing files to device RMX1921...

就我而言,我已经删除了 res 文件夹中的所有 PNG 文件,然后我重新安装了它,它对我有用

I hope this is helpful to someone.我希望这对某人有帮助。

I had the same error and tried the code sample below as well as deleting my .grade, to deleting my .build and .idea which didn't work.我遇到了同样的错误,并尝试了下面的代码示例以及删除我的 .grade,删除我的 .build 和 .idea,这不起作用。

aaptOptions {  
    cruncherEnabled = false  
}  

I later discovered what was causing the error.后来我发现了导致错误的原因。

If the error wasn't caused by changing an image file extension manually.如果错误不是由手动更改图像文件扩展名引起的。 I suggest to check your strings or array.xml and make sure you aren't using a single quote without having backslash before the single quote.我建议检查您的字符串或 array.xml 并确保您没有使用单引号而在单引号之前没有反斜杠。

Error:错误:

Côte d'Ivoire

Fix:使固定:

Côte d\'Ivoire

I tried everything above mentioned but couldn't find anything.我尝试了上面提到的所有内容,但找不到任何东西。 Then I backed up my code and reverted to last runnable commit, after that i copy/pasted my code back to original piece by piece and added the files again and i found out the problem.然后我备份了我的代码并恢复到最后一个可运行的提交,之后我将我的代码逐个复制/粘贴回原始文件并再次添加文件,我发现了问题。 I did <item>Driver's License</item> which i changed to <item>Driver\'s License</item> inside string array in strings.xml file.我做了<item>Driver's License</item> ,我在 strings.xml 文件的字符串数组中更改为<item>Driver\'s License</item>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Gradle Build因“错误:任务执行失败”而崩溃:app:mergeDebugResources&#39;。 &gt; Crunching Cruncher photo.png失败了“ - Gradle Build Fails Due to “Error:Execution failed for task ':app:mergeDebugResources'. > Crunching Cruncher photo.png failed” 九个补丁映像上的错误:一些文件处理失败,有关详细信息,请参阅日志 - Error on nine patch image: Some file crunching failed, see logs for details 错误:java.lang.RuntimeException:某些文件处理失败,请参阅日志以获取详细信息 - Error:java.lang.RuntimeException: Some file crunching failed, see logs for details Android - 错误:任务执行失败':app:mergeDebugResources' - Android - Error:Execution failed for task ':app:mergeDebugResources' 错误:任务&#39;:app:mergeDebugResources&#39;的执行失败 - Error:Execution failed for task ':app:mergeDebugResources' 错误:任务“:app:mergeDebugResources”的执行失败。 - Error:Execution failed for task ':app:mergeDebugResources'. 任务&#39;:app:mergeDebugResources&#39;的错误_Execution失败 - Error _Execution failed for task ':app:mergeDebugResources' 任务“:app:mergeDebugResources”执行失败。 错误 - Execution failed for task ':app:mergeDebugResources'. Error Gradle构建失败,:app:mergeDebugResources失败 - Gradle Build Failed, :app:mergeDebugResources FAILED 任务&#39;:app:mergeDebugResources&#39;的执行失败。 错误:无效的维数 - Execution failed for task ':app:mergeDebugResources'. error: invalid dimen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM