square / dagger

A fast dependency injector for Android and Java.
https://square.github.io/dagger/
Apache License 2.0
7.31k stars 3.06k forks source link

Constructor injection cannot find symbol method inject members dagger2 2.14 #559

Closed skyshine999 closed 6 years ago

skyshine999 commented 6 years ago

When injecting class through constructor injection it's throwing an error that it cannot find symbol. If I provide the dependency through an @Provides method defined inside a module, everything works fine. public class SixthGenericTest {

    @Inject
    FirstTest firstTest;

    @Inject
    public SixthGenericTest()
    {
        Injection.create().getAppComponent().inject(this);
    }
    public String getData(){
        return firstTest.getTestName();
    }
}

@Singleton
@Component(modules = {FirstModule.class})
public interface AppComponent {
    void inject(SixthGenericTest sixthGenericTest);

}

if i try with dagger 2.7 this is working but in 2.14 version it is not working

pforhan commented 6 years ago

You probably want to file this on dagger 2 at https://github.com/google/dagger