我现在面临一个问题超过 3 天,我无法解决。自从我开始在 Android 上使用 Kotlin 以来,我停止使用“annotationProcessor”并开始使用“kapt”,在我开始构建 Android 即时应用程序之前,所有事情都在 kapt 上运行良好,当我将“kapt”添加到任何依赖项(如 Glide)时或 ButterKnife Gradle 总是显示找不到方法 kapt() 的错误
Could not find method kapt() for arguments [com.github.bumptech.glide:compiler:4.7.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Run Code Online (Sandbox Code Playgroud)
这是我的项目 Gradle 文件
项目gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module …Run Code Online (Sandbox Code Playgroud) android gradle kotlin android-gradle-plugin android-instant-apps