目前我正在使用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
我尝试过清洁和重建它,但它没有用。 this问题的答案也不起作用。任何帮助将不胜感激,谢谢。
更新 这是日志输出
* 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
答案 0 :(得分:29)
答案 1 :(得分:19)
答案 2 :(得分:1)
尝试从命令行运行gradle:
gradle clean build --debug
然后发布你的日志。
答案 3 :(得分:1)
只需查看此链接 - Android Studio - mergeDebugResources exception和libpng error: Not a PNG file Error Showing In Android Studio
即可如果您正在使用Linux机器,您可以在控制台上尝试此命令以及sudo apt-get install lib32stdc ++ 6,然后重启android studio并运行您的项目
答案 4 :(得分:1)
对我来说,这是一个损坏的PNG文件。转到res
文件夹,尝试打开每张图片。
答案 5 :(得分:1)
实际上,图片文件出错了。转到(drawable
)并删除图片或替换为新图片。这样可以解决问题。
另外,你可以把方法放在(build.gradle
)中,但这不会解决问题,但能找到错误的好方法。
在build.gradle
部分android {}
,insert (cruncherEnagle = false)apptOptions
。
答案 6 :(得分:0)
压缩项目文件并删除prjct。并提取并打开
答案 7 :(得分:0)
在我的res文件夹中,我创建了一个9PNG文件。删除此文件后,everthing工作正常。
答案 8 :(得分:0)
答案 9 :(得分:0)
对我来说,我收到此错误是因为该文件夹的完整路径比Windows允许的时间长。我将构建移动到较浅的路径,这个错误就消失了。
答案 10 :(得分:0)
在响应本机时
在项目目录中时,请尝试使用:
$ cd android && gradlew clean
$ cd .. && react-native run-android
答案 11 :(得分:0)
我正面临着相同的问题,请检查所有相关答案,但我的问题仍未解决。 我添加了一个可绘制的新文件夹,以在应用程序中添加图标。因此,删除该文件夹后,我的问题已解决。 另外,清洁Gradle,您的问题将得到解决。
cd android && gradlew clean
cd .. && react-native run-android
此外,可能有些数据已损坏,就像您添加的图像一样,请尝试删除这些图像以使其起作用。
答案 12 :(得分:0)
我也有同样的错误。但现在已经修复。
主要问题是某些Gradle文件已损坏。我已经删除了整个.gradle文件,然后再次运行该项目。这次成功了!。
删除.gradle文件后运行时,它会自动修复Gradle文件,如下所示:
登录调试控制台:
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...
答案 13 :(得分:0)
就我而言,我已经删除了 res 文件夹中的所有 PNG 文件,然后我重新安装了它,它对我有用
答案 14 :(得分:0)
我希望这对某人有帮助。
我遇到了同样的错误并尝试了下面的代码示例并删除了我的 .grade,删除了我的 .build 和 .idea 没有用。
aaptOptions {
cruncherEnabled = false
}
我后来发现了导致错误的原因。
如果错误不是由手动更改图像文件扩展名引起的。我建议检查您的字符串或 array.xml 并确保您没有使用单引号,而单引号前没有反斜杠。
错误:
Côte d'Ivoire
修复:
Côte d\'Ivoire