如何将 Kotlin 文件添加到旧的 android java 项目?

我正在尝试基于 ODK Collect 构建一个 android 应用程序。ODK Collect 应用程序是用 Java 编写的。我想使用 Kotlin 进行开发。我使用 android studio 新活动向导添加了一个基于 Kotlin 的空活动。当我尝试编译时,出现以下错误;


Executing tasks: [:collect_app:assembleDebug]



> Configure project :collect_app

Could not find google-services.json while looking in [src/nullnull/odkCollectRelease, src/odkCollectRelease/nullnull, src/nullnull, src/odkCollectRelease, src/nullnullOdkCollectRelease]

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

collect_app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.google.dagger:dagger-android-processor:2.16', 'com.google.dagger:dagger-compiler:2.16', 'com.jakewharton:butterknife-compiler:8.8.1', 'com.google.dagger:dagger-compiler:2.16'.

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin

ODK 收集应用程序:https : //github.com/opendatakit/collect


慕尼黑5688855
浏览 168回答 2
2回答

Smart猫小萌

此问题已在 Kotlin 版本 1.3.20 中修复。

梦里花落0921

这里有一些事情可以尝试在每个之后重建。让我知道事情的后续。尝试单击工具菜单 -> Kotlin -> 在项目中配置 Kotlin。尝试点击工具菜单 -> Kotlin -> 配置 Kotlin 插件更新尝试添加apply plugin: 'kotlin-kapt'尝试单击文件 -> 使缓存无效/重新启动更新 添加到 build.gradlekapt { generateStubs = true }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java