Android项目转Kotlin时出现的异常
2020-09-23 本文已影响0人
xu_pan
使用Android Studio Tools中的工具将Java项目转为Kotlin项目时报了如下错误:
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:
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.
经过一番搜索资料发现,在工具为我们生成配置项时在在根据下的build.gradle中默认为我们添加的版本时1.0.0。 我们只需将其改为Adroid Studio中Plugins kotin插件的版本就可以了,如我的项目改为“1.4.0”就可以正常打包了。