AutoService Unresolved Reference

Hi, I am trying to create Annotation auto generating code based on my class fields,

full annotation line:

@AutoService(Processor::class)

Android studio suggests creating new annotation on this error

I based my code on this tutorial

On both code from tutorial and my current custom code I get the same error

Other tutorials that I used (mainly while searching for lacking dependencies):

https://www.willowtreeapps.com/craft/generating-code-via-annotations-in-kotlin

My build.gradle file:

plugins {
    id 'java-library'
    id 'org.jetbrains.kotlin.jvm'
    id 'kotlin'
    id 'kotlin-kapt'
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_7
    targetCompatibility = JavaVersion.VERSION_1_7
}

dependencies {
    implementation 'androidx.room:room-common:2.4.3'
    kapt project(':annotations')
    implementation project(':annotations')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10"
    implementation 'com.squareup:kotlinpoet:1.8.0'

    annotationProcessor "com.google.auto.service:auto-service:1.0-rc4"
    kapt "com.google.auto.service:auto-service:1.0-rc4"

}

I don’t know how but I missed one line in my build.gradle

implementation 'com.google.auto.service:auto-service-annotations:1.0-rc5'

found this while searching for jars that autoservice library needed

1 Like