question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Generated not found *javax.annotation.processing.Generated*

See original GitHub issue

I am seeing this issue when trying to compile an Android project with Dagger2 (Google I/O 2018 sample app).

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

I have tried the several solutions mentioned in the issues and stack overflow for resolving javax.annoation.Generated but not having any luck. Note the annotation is in the javax.annotation.processing package.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:32
  • Comments:35

github_iconTop GitHub Comments

72reactions
pengradcommented, Feb 10, 2019

Unfortunately, it doesn’t work for android projects. Any tip how we can compile android, jdk9+ and dagger?

Manually create Generated interface in your project. There could be package exists in another module: java.compiler error if adding in android app module, but creating in android-library module (and then adding it to main via implementation project(':module-generated')) works fine.

I’ve uploaded package with such class to JCenter https://github.com/pengrad/jdk9-deps Now it’s possible to just add this gradle dependency and it compiles with JDK11: compileOnly 'com.github.pengrad:jdk9-deps:1.0'

22reactions
ayvazjcommented, Nov 20, 2018

My issue turned out to be related to JDK9 - explicitly using JDK 1.8 resolved the issue for me. ¯\_(ツ)_/¯

Add the following to gradle.properties

org.gradle.java.home={PATH TO JAVA 8}

Note setting JAVA_HOME did not work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generated annotation using gradlew + dagger - Stack Overflow
Dagger uses auto-common 's GeneratedAnnotations to figure out which @Generated annotation to use. It does this based on the classpath.
Read more >
error: cannot find symbol @javax.annotation.Generated
I expected the test case to run easily since I did not change anything from the git clone. What happens instead? error: cannot...
Read more >
Room appears to use the wrong Generated annotation when ...
My application started to fail during compilation. I get the error that the @Generated Annotation can not be found because the package javax.annotation...
Read more >
Generated (Java SE 9 & JDK 9 ) - Oracle Help Center
Package javax.annotation.processing. Annotation Type Generated ... The Generated annotation is used to mark source code that has been generated.
Read more >
Error when building Android capture App build in android studio
... DHIS2\V2\dhis2-android-capture-app\commons\build\generated\source\ ... java:4: error: package javax.annotation.processing does not exist ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found