我尝试将一个 java 类转换为 Kotlin,除了出现以下错误外,它工作正常。我尝试重新下载下面建议的所有依赖项,但无济于事。请帮助我解决这个错误。
错误:
Error:(2, 0) Unable to find method 'org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(Ljava/lang/String;Lorg/gradle/api/internal/file/FileResolver;)V'.
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><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
最佳答案
尝试在 build.gradle 中更新 kotlin 版本。
ext.kotlin_version = '1.3.72'
关于Android gradle 找不到方法 'org.grade.api.internal.file.DefaultSourceDirectorySet',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48048340/