google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.44k stars 2.01k forks source link

Cannot resolve symbol 'Dagger_...' #78

Closed egor-n closed 9 years ago

egor-n commented 9 years ago

Android Studio 0.9.3 Gradle 2.1 Gradle Plugin 0.14.2

Is it supposed to be this way? It's red, but compiles with no problem.

Screeshot

roman-mazur commented 9 years ago

Android Studio does not pick up generated sources automatically. Basically you have to change the output directory for generated sources and tell AS that that folder is a source folder. You might be interested in https://bitbucket.org/hvisser/android-apt or https://github.com/stanfy/gradle-android-apt

daverix commented 9 years ago

It's normal, I don't think the idea looks in the build folder while gradle does.

JakeWharton commented 9 years ago

Use one of the aforementioned plugins.

egor-n commented 9 years ago

Alright, thank you! android-apt seems to work for me. Should it maybe be added in the README a heads up for people like myself?

JakeWharton commented 9 years ago

Yes. Documenting Dagger 2 has only just begun.

pakoito commented 9 years ago

Please do so we don't have to beg for it on SO :+1:

pakoito commented 9 years ago

While these plugins work and projects build just right, created classes are not being picked up by IntelliJ so they're marked down as not found, disabling static code checks.

gk5885 commented 9 years ago

IntelliJ should be able to see the generated types. Take a look at https://github.com/gk5885/dagger-android-sample and see if that configuration works for you.

pakoito commented 9 years ago

Android Studio 1.0-RC1

No

But I was tinkering with it on IntelliJ14 at home over the weekend and it didn't work either.

Project Lombok uses an IDE plugin to circumvent the checks and allow operations on annotated fields, but I don't know if it applies here.

gitcore commented 9 years ago

cannot resolve symbol 'Dagger_...' in eclipse too

I configured the annotation processing but it doesn't work

eclipse Version: Kepler Service Release 1 Build id: 20130919-0819

marwinxxii commented 9 years ago

IntelliJ should be able to see the generated types. Take a look at https://github.com/gk5885/dagger-android-sample and see if that configuration works for you.

I had the same problem with symbols not resolved, but after adding apt plugin as in sample everything worked fine.

I'm using IntelliJ Idea 14.0.2

mgrzechocinski commented 9 years ago

You can try my sample project https://github.com/mgrzechocinski/dagger2-example Sample contains retrolambda&lombok configuration as well.

Be aware, that you have to add com.neenbedankt.android-apt to your project.

jemshit commented 7 years ago

Now struggling on IntelliJ :/ Added apt plugin, enabled annotation processor, marked generated folder as source. But i can't really see any generated file

liminal commented 7 years ago

These are very old instructions. You should not be using apt-plugin today, the functionality is built into the android build plugin (using the keyword annotationProcessor instead of apt in dependencies)

jemshit commented 7 years ago

@liminal i am not talking about android, i am using dagger for pure java project on IntelliJ

tbroyer commented 7 years ago

@jemshit Assuming net.ltgt.apt plugin, make sure you also apply net.ltgt.apt-idea. I also suggest delegating build/run actions to Gradle in IntelliJ (beware, this is a global setting, not actually per-project) so you don't even have to configure annotation processing in IntelliJ; you should then set idea.module.apt.addAptDependencies = false. See https://github.com/tbroyer/gradle-apt-plugin#intellij-idea, come discuss at https://github.com/tbroyer/gradle-apt-plugin/issues if you still have issues (though please review previous issues, particularly those labelled as invalid or question)