Unable to find method 'org.gradle.api.tasks.TaskInputs.file

新手上路,请多包涵

问题描述

我在安装好Android Studio之后,使用Android Studio打开项目,在同步项目的时候发生了以下错误:

Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

问题出现的平台版本及自己尝试过哪些方法

运行环境

运行平台:Windows 10
JAVA JDK版本:javac 1.8.0_231
Android Studio版本:3.5.0.0
硬件平台:AMD R5
虚拟化平台:Hyper-v
Gradle版本:5.4.1

尝试过以下方法

1.升级gradle版本 > 6.0.1
2.降级gradle版本 > 4.1
3.手动指定gradle版本:
image.png

相关代码

// 请把代码文本粘贴到下方(请勿用图片代替代码)

distributionPath\=wrapper/dists  
zipStoreBase\=GRADLE\_USER\_HOME  
zipStorePath\=wrapper/dists  
distributionUrl\=https\\://services.gradle.org/distributions/gradle-5.4.1-all.zip
阅读 6.7k
1 个回答

最好的方式是,用命令行执行编译任务,比如 macOS 下,进入到项目里执行:

./gradlew clean assembleDebug

然后再把日志贴出来

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题