android - 运行时异常 : Some file crunching failed on Android gradle

标签 android android-studio gradle android-gradle-plugin

我在使用 gradle-2.14.1 构建 Android 项目时遇到问题。确切的错误是:

Error:java.lang.RuntimeException: Some file crunching failed, see logs for details
Error:Execution failed for task ':app:mergeInstantrunconfigDebugResources'.
> Error: java.lang.RuntimeException: Some file crunching failed, see logs for details

我通过 stackoverflow 进行了搜索,当使用错误的扩展名重命名图像时可能会出现此问题。我查看了我的可绘制文件夹,发现一些图像已损坏。更换它们,我仍然遇到同样的错误。

我运行了 ./gradlew :app:mergeIntegrationDebugResources --debug > buildLog.txt,这是输出。

....
10:57:28.549 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'binaries' to state DefaultsApplied.
10:57:28.550 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Running model element 'binaries' rule action BinaryBasePlugin.Rules#binaries(BinaryContainer)
10:57:28.550 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Mutating binaries using BinaryBasePlugin.Rules#binaries(BinaryContainer)
10:57:28.557 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'binaries' to state Initialized.
10:57:28.557 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Running model element 'bridgedBinaries' rule action JavaBasePlugin.apply()
10:57:28.557 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Mutating bridgedBinaries using JavaBasePlugin.apply()
10:57:28.557 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'bridgedBinaries' to state Created.
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'bridgedBinaries' to state DefaultsApplied.
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'bridgedBinaries' to state Initialized.
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'bridgedBinaries' to state Mutated.
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'bridgedBinaries' to state Finalized.
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'bridgedBinaries' to state SelfClosed.
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'bridgedBinaries' to state GraphClosed.
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Running model element 'binaries' rule action JavaBasePlugin.Rules#attachBridgedBinaries(BinaryContainer, JavaBasePlugin.BridgedBinaries)
10:57:28.558 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Mutating binaries using JavaBasePlugin.Rules#attachBridgedBinaries(BinaryContainer, JavaBasePlugin.BridgedBinaries)
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'binaries' to state Mutated.
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'binaries' to state Finalized.
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'binaries' to state SelfClosed.
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'binaries' to state GraphClosed.
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Running model element 'tasks' rule action BinaryBasePlugin.Rules#copyBinaryTasksToTaskContainer(TaskContainer, BinaryContainer)
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Mutating tasks using BinaryBasePlugin.Rules#copyBinaryTasksToTaskContainer(TaskContainer, BinaryContainer)
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'tasks' to state Mutated.
10:57:28.559 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'tasks' to state Finalized.
10:57:28.560 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'tasks' to state SelfClosed.
10:57:28.560 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Transitioning model element 'tasks' from state SelfClosed to SelfClosed
10:57:28.576 [LIFECYCLE] [org.gradle.BuildResultLogger] 
10:57:28.576 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
10:57:28.576 [LIFECYCLE] [org.gradle.BuildResultLogger] 
10:57:28.576 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 12.466 secs
10:57:28.652 [DEBUG] [org.jetbrains.kotlin.gradle.plugin.CleanUpBuildListener] [KOTLIN] Skipping kotlin cleanup since compiler wasn't called
10:57:28.657 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-artifacts.bin (C:\Users\carre\.gradle\caches\modules-2\metadata-2.16\module-artifacts.bin)
10:57:28.657 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-versions.bin (C:\Users\carre\.gradle\caches\modules-2\metadata-2.16\module-versions.bin)
10:57:28.658 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache artifact-at-repository.bin (C:\Users\carre\.gradle\caches\modules-2\metadata-2.16\artifact-at-repository.bin)
10:57:28.658 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-metadata.bin (C:\Users\carre\.gradle\caches\modules-2\metadata-2.16\module-metadata.bin)
10:57:28.658 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (C:\Users\carre\.gradle\caches\modules-2).
10:57:28.659 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache Generated Gradle JARs cache (C:\Users\carre\.gradle\caches\2.14.1\generated-gradle-jars) was closed 0 times.
10:57:28.660 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
10:57:28.660 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 8 (avg: 0.001 secs, total: 0.014 secs)
10:57:28.660 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 2 resolution results binary files in 0.001 secs
10:57:28.661 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryCachedRepositoryFactory] In-memory dependency metadata cache closed. Repos cached: 51, cache instances: 5, modules served from cache: 790, artifacts: 306
10:57:28.661 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache Plugin Resolution Cache (C:\Users\carre\.gradle\caches\2.14.1\plugin-resolution) was closed 0 times.
10:57:28.661 [DEBUG] [org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager] Stopping 0 compiler daemon(s).
10:57:28.661 [INFO] [org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager] Stopped 0 compiler daemon(s).
10:57:28.661 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build.
10:57:28.854 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@205f61b
10:57:28.854 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 17: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
10:57:28.856 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Task 'mergeIntegrationDebugResources' not found in project ':app'.] from daemon DaemonInfo{pid=74392, address=[f7c790cc-66ba-4120-aa2e-3a124033e88d port:47413, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], idle=false, lastBusy=1474469837687, context=DefaultDaemonContext[uid=20f3b4f7-83d1-474f-866a-3acdfe8c8c31,javaHome=C:\Program Files\Java\jdk1.8.0_101,daemonRegistryDir=C:\Users\carre\.gradle\daemon,pid=74392,idleTimeout=120000,daemonOpts=-Xmx2560M,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
10:57:28.856 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished

还有其他问题会导致此问题吗?我在我的项目中尝试了最新的 gradle 版本(3.1),但仍然遇到这个问题。

编辑----

我重建了项目,但遇到了同样的错误。这是堆栈跟踪:

:app:generateInstantrunconfigDebugResources UP-TO-DATE
:app:mergeInstantrunconfigDebugResources                 
AAPT err(Facade for 652320281): libpng error: Read Error
AAPT err(Facade for 2075274027): libpng error: Read Error
AAPT err(Facade for 1565297224): libpng error: Read Error
Error: java.lang.RuntimeException: Some file crunching failed, see logs for deta
:app:mergeInstantrunconfigDebugResources FAILED          

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeInstantrunconfigDebugResources'.
> Error: java.lang.RuntimeException: Some file crunching failed, see logs for de

* Try:
Run with --info or --debug option to get more log output.
....
        at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(Abstra
        at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFut
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.j
        at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWr
        ... 79 more
Caused by: java.lang.RuntimeException: Some file crunching failed, see logs for
        at com.android.builder.png.QueuedCruncher.waitForAll(QueuedCruncher.java
        at com.android.builder.png.QueuedCruncher.end(QueuedCruncher.java:303)
        at com.android.builder.internal.aapt.v1.AaptV1.lambda$compile$0(AaptV1.j


BUILD FAILED'

最佳答案

在 Android studio 内的终端上使用您的项目目录尝试此操作,

 ./gradlew clean

关于android - 运行时异常 : Some file crunching failed on Android gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39620315/

相关文章:

android: android.provider.Telephony.SMS_RECEIVED 在哪里?

android - CardView在Android中未显示Youtube缩略图 View

java - 无法解决依赖关系conciseclock

android - ARCore Release build 的问题

java - 在Scala内置的类文件上运行Java源注释处理

android - 无法安装未签名的 APK - 谷歌地图应用

Android 设备选择器 - 设备未显示

android - 更新 android studio 时打补丁失败

Gradle 抛出 : Unable to establish loopback connection

android - 无法从android studio上的github导入项目