3

I am using some kotlin classes in an existing Android project(already having realm), the kotlin classes are not using any realm feature, now on runtime I am getting this error

:app:compileDebugKotlin Using kotlin incremental compilation :app:compileDebugJavaWithJavac Destination for generated sources was modified by kapt. Previous value = /home/debu/AndroidStudioProjects/WT_Application/app/build/generated/source/apt/debug error: Annotation processor '__gen.AnnotationProcessorWrapper_debug_io_realm_processor_RealmProcessor' not found 1 error :app:compileDebugJavaWithJavac FAILED :app:copyDebugKotlinClasses SKIPPED FAILURE: Build failed with an exception. 

my app's build.gradle

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'realm-android' android { def globalConfiguration = rootProject.extensions.getByName("ext") compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion") buildToolsVersion globalConfiguration.getAt("androidBuildToolsVersion") defaultConfig { applicationId globalConfiguration.getAt("androidApplicationId") minSdkVersion globalConfiguration.getAt("androidMinSdkVersion") targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion") versionCode globalConfiguration.getAt("androidVersionCode") versionName globalConfiguration.getAt("androidVersionName") testInstrumentationRunner globalConfiguration.getAt("testInstrumentationRunner") /*jackOptions { enabled true }*/ } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } dataBinding { enabled = true } } dependencies { def presentationDependencies = rootProject.ext.presentationDependencies def presentationTestDependencies = rootProject.ext.presentationTestDependencies def developmentDependencies = rootProject.ext.developmentDependencies compile presentationDependencies.dagger compile presentationDependencies.butterKnife compile presentationDependencies.recyclerView compile presentationDependencies.cardview compile presentationDependencies.rxJava compile presentationDependencies.rxAndroid compile presentationDependencies.appcompat compile presentationDependencies.constraintLayout compile presentationDependencies.design compile presentationDependencies.retrofit compile presentationDependencies.gsonconverter compile presentationDependencies.rxjavaadapter compile presentationDependencies.glide compile presentationDependencies.flexbox compile presentationDependencies.maps compile presentationDependencies.mapUtils compile presentationDependencies.pagerIndicator annotationProcessor presentationDependencies.daggerCompiler annotationProcessor presentationDependencies.butterKnifeCompiler provided presentationDependencies.javaxAnnotation compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" androidTestCompile presentationTestDependencies.junit androidTestCompile presentationTestDependencies.mockito androidTestCompile presentationTestDependencies.dexmaker androidTestCompile presentationTestDependencies.dexmakerMockito androidTestCompile presentationTestDependencies.espresso androidTestCompile presentationTestDependencies.testingSupportLib //Development compile developmentDependencies.leakCanary compile files('libs/YouTubeAndroidPlayerApi.jar') } repositories { mavenCentral() } 

project build.gradle

apply from: 'buildsystem/dependencies.gradle' buildscript { ext.kotlin_version = '1.1.2-4' repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' classpath "io.realm:realm-gradle-plugin:3.2.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { ext { androidApplicationId = 'com.wandertrails' androidVersionCode = 1 androidVersionName = "1.0" testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" testApplicationId = 'com.wandertrails.test' } } task clean(type: Delete) { delete rootProject.buildDir } 

Now can someone kindly figure out what is the reason of this error????

4
  • 1
    Please try to add the annotation processor dependencies to the kapt configuration as well: kapt presentationDependencies.daggerCompiler, kapt presentationDependencies.butterKnifeCompiler, and see if it works. Commented May 18, 2017 at 12:58
  • now I am getting the following error - Error:Circular dependency between the following tasks: :app:compileDebugKotlin \--- :app:kaptDebugKotlin \--- :app:compileDebugKotlin () () - details omitted (listed previously) Commented May 18, 2017 at 13:14
  • 2
    If you are using Android Gradle plugin 3.0.0-alpha1, then the circular dependency is a known issue caused by Data Binding, please see stackoverflow.com/questions/44035504/…; Probably the workaround described there (reverting to Kotlin 1.1.2-2 and disabling IC) will fix this. Commented May 18, 2017 at 13:26
  • Possible duplicate of Android test in kotlin of realm Commented Oct 24, 2017 at 13:33

1 Answer 1

3
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: 'realm-android' 

And

kapt presentationDependencies.daggerCompiler kapt presentationDependencies.butterKnifeCompiler 

Might fix it.

Sign up to request clarification or add additional context in comments.

2 Comments

after adding the lines errors are gone - annotationProcessor presentationDependencies.daggerCompiler annotationProcessor presentationDependencies.butterKnifeCompiler kapt presentationDependencies.daggerCompiler kapt presentationDependencies.butterKnife kapt "com.android.databinding:compiler:2.3.2" now a new problem arrives, butterknife not working(BK ver - 8.6.0, Gradle ver - 3.4.1)
@Debu Would you please accept this answer? This question has nothing to do with Butterknife. You'll want to open a new question for that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.