Gradle DSL method not found: 'kapt()'

大憨熊 提交于 2019-12-04 09:03:23

问题


Gradle DSL method not found: 'kapt()' Possible causes: The project 'jetpacklearn' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Upgrade plugin to version 3.4.0 and sync project

The project 'jetpacklearn' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file

My gradleVersion is '3.4.0', but can not deal with it , ask me the same question

    classpath "com.android.tools.build:gradle:$gradleVersion"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"

回答1:


Check if you have this in top of your app build.gradle?

apply plugin: 'kotlin-kapt'



回答2:


add this line

apply plugin: 'kotlin-kapt'

if you used kapt in android library you must add kotlin-android plugin in your project

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'



回答3:


Add this in your build.gradle then sync the gradle again.

apply plugin: 'kotlin-kapt'




回答4:


just add this line in your app-level of build.grale :

apply plugin: 'kotlin-kapt'

NOTE: under apply plugin: 'com.android.application'



来源:https://stackoverflow.com/questions/56100431/gradle-dsl-method-not-found-kapt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!