我在使用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,并且在使用错误的扩展名重命名图像时可能会出现此问题。我查看了我的drawables文件夹,看到一些图像已损坏。替换它们,我仍然得到同样的错误。
我跑./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'
答案 0 :(得分:2)
在Android studio的终端上使用您的项目目录
尝试此操作 ./gradlew clean