我最近几天一直在面临这个问题。当我尝试构建项目时,Gradle会抛出以下错误信息。我已经清理了项目并重新下载了依赖项,但问题仍未得到解决。
请帮助我找到解决方案。
错误信息:
请帮助我找到解决方案。
错误信息:
:app:dexDebug
Error:org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter$FileCollectionSnapshotImpl cannot be cast to org.gradle.api.internal.changedetection.state.OutputFilesCollectionSnapshotter$OutputFilesSnapshot
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
C:\ Users \<username> \ .gradle \ cache
,在Linux / Mac上为〜/ .gradle / cache
。 - rciovati./gradle --stop
停止所有守护进程。你的项目是否使用 Gradle Wrapper?如果是,那么你不需要使用本地的 Gradle 安装,只需运行命令./gradlew build
即可。 - Blundell