Android-Room error: package javax.annotation.processing does not exist

Viewed 8496

I have an android project with java and kotlin. When i execute 'gradle app:assemble", i get the error output:

error: package javax.annotation.processing does not exist import javax.annotation.processing.Generated;

error: cannot find symbol @Generated("androidx.room.RoomProcessor")

I added 'com.google.code.findbugs:jsr305:3.0.2' but it's not working.

4 Answers

Dependencies for Room in my project are implementation "androidx.room:room-runtime:$room_version", "androidx.room:room-compiler:$room_version".

i add compileOnly 'com.github.pengrad:jdk9-deps:1.0'. it works for me.

I added this line of code in the file build.gradle(:app) in the part of dependencies and it works!

dependencies { compileOnly 'com.github.pengrad:jdk9-deps:1.0'

enter image description here

Source: https://github.com/pengrad/jdk9-deps

it seem you didn't added annotation Processor dependencies add this line in app Gradle file annotationProcessor 'androidx.room:room-compiler:2.2.5'

Without adding any dependencies, I was able to get this working.

For me, I reverted (or stayed) at the last stable Gradle Plugin: 7.0.3 (there are alpha and beta versions available.

When trying to update to newer versions, I had this build issue.

Related