Comments (12)
@sockeqwe: just fast fix but did you tried to add this:
compile 'org.glassfish:javax.annotation:10.0-b28'
from dagger.
Probably this happened because the system JDK_HOME is more upgraded then the JDK that comes with Android Studio
from dagger.
I have installed sdkman more here: https://sdkman.io/usage#installdefault, downgraded java version from 11 to 8 and this error did go away. That way it worked for me.
from dagger.
jep, that works!
I think this dependecy should be part of the core
module dependency, shouldn't it?
Im wondering if I'm the only one who is facing this problem?
from dagger.
Oh, it seems that it's working fine with provided
scope, but I'm not sure why (the dependency is still missing?!?!?).
My problem was, that I have used apt
instead of provided
. In the apt generated code @Generated
can not be resolved. After cleaning the project and using provided everything works. I'm still wondering why it works with provided, because the dependency to @Generated
is missing ... I guess it's because @Generated
has retention policy source ...
from dagger.
javax.annotation.Generated
is part of the JDK since at least Java 6, so maybe the problem is that you're using the Android API: square/javapoet#139 (comment)
(disclaimer: I don't do Android development)
That said, you need @Generated
to be in your compilation classpath (compile
or provided
) because it's part of a (generated) source file that will be compiled; not in your processor path (apt
) which is about the code that will generate that java source. And because it's an annotation that's not needed at runtime, iff you need to include a dependency to get that annotation in the compilation classpath (btw javax.annotation:javax.annotation-api:1.2
is more recent), then use the provided
scope.
from dagger.
Yep. Android's API jar lacks Generated. You will always need to include an
additional dependency on the glassfish jar for Android projects.
On Dec 17, 2014 2:43 AM, "Thomas Broyer" [email protected] wrote:
javax.annotation.Generated is part of the JDK since at least Java 6, so
maybe the problem is that you're using the Android API: square/javapoet#139
(comment)
square/javapoet#139 (comment)
(disclaimer: I don't do Android development)That said, you need @generated to be in your compilation classpath (
compile or provided) because it's part of a (generated) source file that
will be compiled; not in your processor path (apt) which is about the
code that will generate that java source. And because it's an annotation
that's not needed at runtime, iff you need to include a dependency to get
that annotation in the compilation classpath (btw
javax.annotation:javax.annotation-api:1.2 is more recent), then use the
provided scope.—
Reply to this email directly or view it on GitHub
#95 (comment).
from dagger.
this is a local project configuration matter. If you're targetting a JVM that doesnt' have it, you need to add it, per the instructions above.
from dagger.
Why Glassfish? Why not the official Java annotations from Oracle?
from dagger.
I think the correct dependency which should be added is javax.annotation:jsr250-api:1.0
. At least this one only contains the annotations from JSR 250.
I added this to my Android Gradle project:
provided 'javax.annotation:jsr250-api:1.0'
from dagger.
I just submitted some code (and will be linked to this issue in the next MOE sync) that omits @Generated
and instead includes a comment about the generation step if javax.annotation.Generated
is not on the compile-time classpath.
from dagger.
The commit which omits @generated is now synced and should be in a 2.1-SNAPSHOT
from dagger.
Related Issues (20)
- Unable to build with 2.48.1 - 2.49 and 2.50 HOT 2
- KSP processing does not see member injections from typealiased superclass in 2.50 HOT 2
- Regression "warning: [cast] redundant cast to Map" when updating from 2.49 to 2.50 HOT 1
- Dagger-Hilt 2.49: Activity onCreate() and onDestroy() code is generated, but our base Activity class has these final HOT 3
- Dagger 2.50 produces code that calls deprecated method HOT 1
- Feature Request: lint rule for EarlyAccessPoint classes to prevent @Inject abuse HOT 13
- no
- Feature request: Add support for K2 compiler. HOT 2
- @HiltViewModel Unit test problem. HOT 2
- WorkerAssistedFactories are not created on APK builds HOT 5
- Getting `Unexpected annotation value: TransformedVisibilityMarker` error during unit test HOT 5
- @BindsInstance on Component.Factory supertype lambda parameters HOT 1
- SecurityException when trying to run UI test with hilt and Jetpack Compose on Android 14 HOT 3
- BadParcelableException in Activity onCreate HOT 3
- Dagger 2.50 KSP fails to generate field in implementation for a @Named field HOT 2
- Conflicting documentation for dagger.android and Hilt optional inject HOT 3
- [KSP] dagger-android hanging indefinitely on a large multi module project HOT 2
- Optional bindings in a parent component can sometimes use bindings from child components HOT 2
- NullPointerException dagger.spi.shaded.androidx.room.compiler.processing.XTypeElement.getAnnotation HOT 6
- Problem with Injection of DAO HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dagger.