-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Generated not found *javax.annotation.processing.Generated* #1339
Comments
Are you using |
Same issue on my teamcity CI server (clean assembleDebug).
But on local PC works fine
Dependencies:
where Error
|
I am using (for Android)
I have also manually tried setting JAVA_HOME to jdk1.8 and jdk9 - same result. |
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
Note setting JAVA_HOME did not work for me |
Thank you. I checked my environment and found jdk11 and jdk8. Uninstall and reinstall only jdk8 removed this error. |
I am seeing the same issue when trying to compile with JDK10:
|
Fwiw, with 2.14 (using auto-common 0.9), Dagger will use tasks.withType(JavaCompile) {
options.compilerArgs += [ "--release", "8" ]
} From 2.15 onward (using auto-common 0.10), Dagger will also respect |
I have created a simple android application written in kotlin with an empty dagger component:
When trying to compile with dagger 2.19 and JDK10 dagger adds javax.annotation.processing.Generated annotation to DaggerAppComponent class and compilation fails with:
Compiling with JDK8 works fine. There is no @generated annotation added. When I switch to dagger 2.13 it does not add @generated for both JDK10 and JDK8. |
there is no way to make it work with Java 11? |
just in case, if you don't want to put it to gradle.properties, you can use |
Unfortunately, it doesn't work for android projects. Any tip how we can compile android, jdk9+ and dagger? |
Manually create I've uploaded package with such class to JCenter https://github.com/pengrad/jdk9-deps |
Let's converge on #1449 which seems to be the same, and advanced pretty quickly. In particular it seems like there's a kapt bug that will be linked there. |
It work for me. Thank you so much! |
…ion issues. Updates in typings.
Thanks a lot @pengrad , I think I'm very close. My team doesn't approve the external dependency of
It's all well and good in my library modules, however, it's not working for my
Any idea what I'm missing? |
@ericntd I am facing the same problems on Android Studio 4.2 Preview and Dagger 2.22. I was not able to use this I was trying with: |
The issue seems to have gone away with Android Studio 4.2 Canary 14 @MichalDanielDobrzanski |
Having same issue with Canary 14 |
processors generate source that matches the target version. For example see: google/dagger#1339
* Fix breakages in experimental_use_java_builder flow. Make examples/android use custom toolchain with both experimental_use_abi_jars and experimental_use_java_builder to validate this flow. * Pass Java source version for KAPT. This is required such that annotation processors generate source that matches the target version. For example see: google/dagger#1339 * ABI classes should be written to a separate folder to avoid polluting the ABI jar with non-ABI classes * Maintain mnemonic to distinguish between KotlinKapt + KotlinCompile (Both belong to the same worker group) * Add default java + kotlin compiler options
Also having issues with the Canary release, instead installed the stable AS release v4.1 at the time of writing and since have no issues with the stable AS |
4.2 preview same issue. if i use 4.0 works..whats the issue? |
If you are updating your android studio and using arctic fox (2020.3.1) don't forget to update the gradle plugin. |
with the stable Android Studio 4.2, I have the same problem with Dagger 2.25, after I updated dagger to latest version, the problem solved |
@pandelisgreen13 are you using the room library in the project? |
Updating the dagger version doesnt work for me. Is there any other way to resolve this issue? I have explicitly selected Source Compatibility and Target Compatibility as 1_8, while my mac has java 9 installed. |
Yes, we have Room sourceCompatibility = JavaVersion.VERSION_1_8 |
me too using the same but getting issue
at last, downloaded the previous version |
Had this issue with Android Studio 4.2. Tried solutions from above and what finally worked was to update Kotlin from 1.3.50 to 1.4.31. |
Also, make sure to update gradle plugin to 4.2.0 according to this https://developer.android.com/studio/releases/gradle-plugin#4-2-0 |
I recently had this issue on a project when migrating to java 11. I figured out the issue was caused by me using an outdated version of assisted-inject. I made it work by updating dagger to
|
I get this on a very under-developed project, fix was to update Dagger from 2.14.1 to 2.25.4 (before Android X as my project is not upgraded yet). About time to do that methinks. |
This
And this, did it for me on Android Studio 4.2.1. Thank you very very very much. |
I was using Java 11 and I change it to 1.8 and this issue fixed.
|
I have this issue this morning and after spent hours on trying different things and Java versions, this fixed my problem. So, add |
this add in dependency. // implementation 'javax.annotation:javax.annotation-api:1.3.2' |
* Fix breakages in experimental_use_java_builder flow. Make examples/android use custom toolchain with both experimental_use_abi_jars and experimental_use_java_builder to validate this flow. * Pass Java source version for KAPT. This is required such that annotation processors generate source that matches the target version. For example see: google/dagger#1339 * ABI classes should be written to a separate folder to avoid polluting the ABI jar with non-ABI classes * Maintain mnemonic to distinguish between KotlinKapt + KotlinCompile (Both belong to the same worker group) * Add default java + kotlin compiler options
Close ide, navigate to project folder, delete build folder(contains generated file etc), then launch project in ide again, that solve the issue. |
I tried it in spring boot with java 1.8 and it doesn't let me run the project after including it in my clashpath |
Just add this dependency implementation 'javax.annotation:javax.annotation-api:1.3.2' |
@rathorerahul586 .... previous version of what? |
Android Studio |
I fixed the issue with
|
I am seeing this issue when trying to compile an Android project with Dagger2 (Google I/O 2018 sample app).
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 thejavax.annotation.processing
package.The text was updated successfully, but these errors were encountered: