Git Product home page Git Product logo

Comments (12)

radzio avatar radzio commented on April 28, 2024 8

@sockeqwe: just fast fix but did you tried to add this:

compile 'org.glassfish:javax.annotation:10.0-b28'

from dagger.

rafnogueira avatar rafnogueira commented on April 28, 2024 5

Probably this happened because the system JDK_HOME is more upgraded then the JDK that comes with Android Studio

from dagger.

RiteshAdulkar avatar RiteshAdulkar commented on April 28, 2024 2

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.

sockeqwe avatar sockeqwe commented on April 28, 2024

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.

sockeqwe avatar sockeqwe commented on April 28, 2024

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.

tbroyer avatar tbroyer commented on April 28, 2024

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.

JakeWharton avatar JakeWharton commented on April 28, 2024

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.

cgruber avatar cgruber commented on April 28, 2024

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.

mttkay avatar mttkay commented on April 28, 2024

Why Glassfish? Why not the official Java annotations from Oracle?

https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.pom

from dagger.

svenjacobs avatar svenjacobs commented on April 28, 2024

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.

ronshapiro avatar ronshapiro commented on April 28, 2024

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.

ronshapiro avatar ronshapiro commented on April 28, 2024

The commit which omits @generated is now synced and should be in a 2.1-SNAPSHOT

from dagger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.