Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle DSL method not found: 'kapt()'

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" 
like image 866
cheng zhang Avatar asked May 12 '19 14:05

cheng zhang


Video Answer


2 Answers

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

apply plugin: 'kotlin-kapt' 
like image 137
Ignacio Tomas Crespo Avatar answered Oct 19 '22 22:10

Ignacio Tomas Crespo


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' 
like image 30
Kourosh Avatar answered Oct 19 '22 22:10

Kourosh