google / dagger

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

Examples don't compile #87

Closed imbeyondboredom closed 9 years ago

imbeyondboredom commented 9 years ago

I know you guys are still in the process of making the examples, but at this point they don't work at all. One such example is that https://github.com/google/dagger/blob/master/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AbstractActivityComponent.java has a different class name than the file.

This makes determining how everything is supposed to work fairly difficult if you don't already understand the intricacies of the Dagger2 implementation.

gk5885 commented 9 years ago

I totally agree. @cgruber did the conversion. Christian, can you take a look here?

cgruber commented 9 years ago

Thats confusing to me as they compiled when I ran them, but I'll confirm and fix.

On Tue, Dec 2, 2014, 09:30 Gregory Kick notifications@github.com wrote:

Assigned #87 https://github.com/google/dagger/issues/87 to @cgruber https://github.com/cgruber.

— Reply to this email directly or view it on GitHub https://github.com/google/dagger/issues/87#event-201373368.

nguyentruongtho commented 9 years ago

With default profile, they will compile but with android profile, it will not because of the error reported above, see https://github.com/google/dagger/blob/master/examples/pom.xml#L32-L49. android-activity-graphs is not compilable.

liminal commented 9 years ago

How could the version of the sample code in github master possibly compile? Look at for instance https://github.com/google/dagger/blob/master/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeActivity.java#L26 where the refrenced field is never declared.

nguyentruongtho commented 9 years ago

@liminal It is not hard to fix this compilation issue, I think the maintainers are busy. Meanwhile, you can checkout my fix here https://github.com/google/dagger/pull/93.

mgrzechocinski commented 9 years ago

You can also checkout my sample project https://github.com/mgrzechocinski/dagger2-example

EverybodyKurts commented 9 years ago

Yes, I ran into this problem as well! This is my first taste of Dagger and while I know Dagger 2 hasn't been officially released yet, I was scratching my head as to what I was possibly doing wrong. @nguyentruongtho, @mgrzechocinski I'll take a look at your sample projects and see if I can get further.

cgruber commented 9 years ago

Largely addressed in #93 and #145