在更新了一个使用gradle 6.7.1和Android 4.2.1的项目之后,我得到了以下错误:
Unable to find method ''java.io.File com.android.build.gradle.tasks.PackageAndroidArtifact.getOutputDirectory()''
'java.io.File com.android.build.gradle.tasks.PackageAndroidArtifact.getOutputDirectory()'
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.
尝试1)无效的缓存/重新启动作为2)清理重建项目3)删除.gradle和.build文件夹
发布于 2021-05-25 07:57:26
我有同样的问题,我解决了将SDK版本更改为30.0.2,根据官方文档:https://developer.android.com/studio/releases/gradle-plugin#compatibility
此外,我还需要更新主build.gradle文件(顶级)中的其他插件版本。“您的项目可能使用与项目中的其他插件或项目所要求的Gradle版本不兼容的第三方插件。”
我希望这对你也有帮助。
https://stackoverflow.com/questions/67576051
复制相似问题