Hyeyeon
Hyeyeon

Reputation: 421

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

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.

Upvotes: 10

Views: 12499

Answers (4)

Booger
Booger

Reputation: 18725

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.

Upvotes: 0

Daniela Ramirez Gomez
Daniela Ramirez Gomez

Reputation: 59

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

Upvotes: 4

Hyeyeon
Hyeyeon

Reputation: 421

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.

Upvotes: 21

sourabh karmakar
sourabh karmakar

Reputation: 191

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

Upvotes: 0

Related Questions