在现有 java/Android 项目中添加 Kotlin class 时出错

Error while adding a Kotlin class in existing java/Android project

我正在尝试在我现有的 android 项目中使用 Kotlin。它使用许多第三方库,如 Android Annotations、Dagger、Glide 等。在 build.gradle 文件中进行一些必要的标准更改后,我收到此错误。

error: no suitable constructor found for RequestManager(Glide,Lifecycle,RequestManagerTreeNode,Context) constructor RequestManager.RequestManager(Glide,Lifecycle,RequestManagerTreeNode) is not applicable (actual and formal argument lists differ in length) constructor RequestManager.RequestManager(Glide,Lifecycle,RequestManagerTreeNode,RequestTracker,ConnectivityMonitorFactory) is not applicable (actual and formal argument lists differ in length)

此错误出现在自动生成的文件中 GlideRequest.java。我不知道如何解决这个问题。我可能会在这里错过什么?任何帮助表示赞赏。

我犯了一个愚蠢的错误,导致了这个错误。如果其他人遇到类似问题,请确保该库及其编译器(kapt/annotation 处理器)使用相同的版本。例如-

kapt "com.github.bumptech.glide:compiler:$glideVersion"

compile com.github.bumptech.glide:glide:$glideVersion"

我错误地在上面有两个不同的版本。