"RepositoryImpl은 @Inject 생성자없이 또는 @이 제공-주석 방법을에서 제공 할 수 없다"단검이 오류 : I 인터페이스 다음 한 예를 들어
public interface Repository {
Observable<Pojo> getPojos();
}
및 구현 :
public class RepositoryImpl implements Repository {
public RepositoryImpl() {
}
@Override
public Observable<Pojo> getPojos() {
return null;
}
}
모듈 :
@Module
class AppModule {
public AppModule() {
}
@Provides
@Singleton
Repository provideRepositoryImpl() {
return new RepositoryImpl();
}
}
그리고 구성 요소 :
@Singleton
@Component(modules = { AppModule.class })
public interface AppComponent {
void inject(MainActivity mainActivity);
}
프로젝트를 만들 때 질문 제목과 같은 오류가 나타납니다. 내 코드에서 어떤 문제가 있습니까?
이 단검은 Application 클래스에 주입됩니다 일반적으로 어디 분사의 응용 프로그램 클래스에 대한? –