``` apply plugin: 'kotlin-android' ... kapt { ...
# android
l
Copy code
apply plugin: 'kotlin-android'
...
kapt {
    generateStubs = true
  }

  sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
  }
...
kapt 'com.android.databinding:compiler:2.3.2'
Slack Conversation
e
leodeleon: Are you sure the compiler version aligns with the
com.android.tools.build:gradle
version?
l
Yes
Do you have
apply plugin: 'kotlin-kapt'
?
l
Copy code
buildscript {
    ext.kotlin_version = '1.1.2-4'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "<https://maven.google.com>"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Copy code
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "florent37.github.com.githubnewandroidarchitecture"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
        }
    }

    dataBinding {
        enabled = true;
    }
  kapt {
    generateStubs = true
  }

  sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
  }

    compileOptions.incremental = false

}

ext {
    buildToolsVersion = "25.0.2"
    supportLibVersion = "25.3.1"
    archLifecycleVersion = "1.0.0-alpha1"
}

dependencies {
    compile 'com.android.support:appcompat-v7:' + project.supportLibVersion
    compile 'com.android.support.constraint:constraint-layout:1.0.0'

    compile 'com.google.dagger:dagger:2.10'

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'

    compile 'com.android.support:appcompat-v7:' + project.supportLibVersion;
    compile 'com.android.support:cardview-v7:' + project.supportLibVersion;
    compile 'com.android.support:recyclerview-v7:' + project.supportLibVersion;

  kapt 'com.google.dagger:dagger-compiler:2.10'
  kapt 'com.android.databinding:compiler:2.2.3'
  provided 'org.glassfish:javax.annotation:10.0-b28'

    compile 'android.arch.lifecycle:extensions:' + project.archLifecycleVersion;
    kapt "android.arch.lifecycle:compiler:" + project.archLifecycleVersion
  compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"


    //compile 'android.arch.persistence.room:runtime:' + rootProject.archRoomVersion;
    //annotationProcessor "android.arch.persistence.room:compiler:" + rootProject.archRoomVersion;

}
repositories {
  mavenCentral()
}
Now I have this problem
Copy code
Error:Circular dependency between the following tasks:
:app:compileDebugKotlin
\--- :app:kaptDebugKotlin
     \--- :app:compileDebugKotlin (*)
(*) - details omitted (listed previously)
e
I can try help you later today, swamped with work now. It is possible to make it work, we use dagger2, databinding and kotlin in our project without problems.
l
yeah, I’m trying to convert this sample project
t
your gradle is 2.3.2 but dataginding is 2.2.3
i
Kapt{} should be outside android{} right?
t
kapt { generateStubs = true }
is no longer needed.