代码之家  ›  专栏  ›  技术社区  ›  Rajas47Ashtikar

找不到glide的方法kapt()

  •  5
  • Rajas47Ashtikar  · 技术社区  · 6 年前
    apply plugin: 'com.google.gms.google-services'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'kotlin-kapt'
    
    classpath 'com.android.tools.build:gradle:3.2.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.61"
    

    我有上述梯度配置,但我仍然得到

    Could not find method kapt() for arguments [com.github.bumptech.glide:compiler:4.3.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
    

    有人能告诉我哪里出了问题吗?提前谢谢你的帮助

    2 回复  |  直到 3 年前
        1
  •  55
  •   Martin Zeitler    5 年前

    项目层面 build.gradle :

    buildscript {
        repositories {
            mavenCentral()
            jcenter()
            google()
        }
        dependencies {
            classpath "com.android.tools.build:gradle:3.3.2"
            classpath "com.google.gms:google-services:4.2.0"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.70"
        }
    }
    

    模块级 构建.gradle

    apply plugin: "kotlin-android"
    apply plugin: "kotlin-android-extensions"
    apply plugin: "kotlin-kapt"
    ...
    android {
    
    } 
    dependencies {
        implementation "com.github.bumptech.glide:glide:4.8.0"
        // annotationProcessor "com.github.bumptech.glide:compiler:4.8.0"
        kapt "com.github.bumptech.glide:compiler:4.8.0"
    }
    ...
    apply plugin: "com.google.gms.google-services"
    
        2
  •  8
  •   Fortran    4 年前
    plugins {
        id 'com.android.application'
        id 'kotlin-android'
        id 'kotlin-android-extensions'
        id 'kotlin-kapt' // add this line in file build.gradle (Module : YourAppName)
    }
    
        3
  •  -3
  •   ʍѳђઽ૯ท    6 年前

    kapt 新版本的 Glide 因此,尝试添加:

    kapt 'com.github.bumptech.glide:compiler:4.8.0'
    

    Build.gradle 依赖项 when using Kotlin .

    dependencies {
        implementation 'com.github.bumptech.glide:glide:4.8.0'
        kapt 'com.github.bumptech.glide:compiler:4.8.0'
    }
    

    1.2.71 :

    buildscript {
    
        ext.kotlin_version = '1.2.71'
    }
    
    
     dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
    

    构建.gradle . 这应该管用。