在最新检查期间无法捕获任务':checkDevClasspath'属性'compileClasspath'的输入文件的指纹

Bra*_*rad 5 java android gradle android-studio android-gradle-plugin

我正在尝试在Android Studio中升级到gradle 3.2.1,但是gradle构建失败并出现以下错误。

 FAILURE: Build failed with an exception.

 * What went wrong:
 Failed to capture the fingerprint of input files for task ':checkDevDebugClasspath' property 'compileClasspath' during the up-to-date check.
 > 1

 * Try:
  Run with --scan to get full insights.

 * Exception is:
 org.gradle.api.UncheckedIOException: Failed to capture fingerprint of input files for task ':checkDevDebugClasspath' property 'compileClasspath' during up-to-date check.
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.fingerprintTaskFiles(CacheBackedTaskHistoryRepository.java:360)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.createExecution(CacheBackedTaskHistoryRepository.java:163)
Run Code Online (Sandbox Code Playgroud)

不知道发生了什么

Ahm*_*ien 1

我知道这是一个老问题,但我多次遇到过它,并以不同的方式解决了它。这可能是由多种原因引起的,但这意味着构建项目时缺少使用的资源(模块)。

如果您使用的是纯安卓;我建议清理项目然后重建它,如下所示:

cd android
./gradlew clean assemble
Run Code Online (Sandbox Code Playgroud)

安卓注意事项;如果您依赖其他模块,请确保它们存在并正确设置。还要确保您没有任何损坏的符号链接。

如果你使用的是react-native,你可以清理android和node_modules并重建。大多数损坏的依赖项将位于 node_modules 中:

rm -rf node_modules
yarn install # Or npm install if you aren't using yarn
cd android
./gradlew clean
cd ..
react-native run-android # Or expo start if you are on expokit
Run Code Online (Sandbox Code Playgroud)

关于反应本机的注意事项;确保您使用的是有效版本的nodejs并且节点模块已成功安装。对我来说,大多数时候问题是因为我使用了更新的nodejs版本并且节点模块没有正确安装。