[Dagger/MissingBinding] LoginUI cannot be provided without an @Inject constructor or an @Provides-annotated method. This type supports members injection but cannot be implicitly provided.
@Component(modules = {AndroidInjectionModule.class, ActivityModule.class, FragmentModule.class, ......})
@AccountCore
@Singleton
public interface MyApplicationComponent extends AndroidInjector<App> {
AccountComponent.Builder getAccountComponent();
SprintComponent.Builder getSprintComponent();
void inject(App app);
ActivityModule
@Module(includes = {AccountViewModule.class,.......})
public abstract class ActivityModule {
AccountViewModule
@Module(includes = {xxxx.class, xxx.class})
public abstract class AccountViewModule {
@Binds
abstract LoginPresenter provideLoginPresenter(LoginPresenterImpl presenter);
@ContributesAndroidInjector()
public abstract LoginUI provideLoginUI();
@Binds
public abstract AccountView.LoginView provideLoginView(LoginUI loginUI);
LoginUI
public class LoginUI extends DaggerActivity {
@Inject
LoginPresenter accountPresenter;
LoginPresenterImpl
public class LoginPresenterImpl extends AccountPresenter implements LoginPresenter {
@Inject
AccountClient accountClient;
@Inject
AccountView.LoginView loginView;
@Inject
AccountModel accountModel;
buildToolsVersion = "29.0.2"
supportVersion = "29.0.2"
compileSdkVersion = 28
minSdkVersion = 18
targetSdkVersion = 28
lifecycleVersion = "1.1.1"
daggerVersion = "2.28.3"
rxJavaVersion = "1.2.1"
okHttpVertion = "3.9.1"
retrofitVersion = "2.1.0"
kotlin_version = "1.3.72"
gradle_version = "3.1.4"
glide_version = "4.11.0"
thanks in Advanced
This seems like the dagger-android-processor is not running. Can you confirm that you have added the following dependency:
kapt com.google.dagger:dagger-android-processor:<VERSION>
This seems like the dagger-android-processor is not running. Can you confirm that you have added the following dependency:
kapt com.google.dagger:dagger-android-processor:<VERSION>
@bcorso Thank you for reply
I already added processor
here is my code
implementation 'com.google.dagger:dagger:' + daggerVersion
implementation 'com.google.dagger:dagger-android:' + daggerVersion
implementation 'com.google.dagger:dagger-android-support:' + daggerVersion
kapt 'com.google.dagger:dagger-android-processor:' + daggerVersion
kapt 'com.google.dagger:dagger-compiler:' + daggerVersion
It's difficult to say without having a real example to debug, but one issue I see is that the @Binds is in the same module as the ContributesAndroidInjector, as shown below.
@Module
public abstract class AccountViewModule {
@ContributesAndroidInjector()
abstract LoginUI provideLoginUI();
@Binds abstract AccountView.LoginView provideLoginView(LoginUI loginUI);
However, I think these need to be in separate modules because the @ContributesAndroidInjector needs to be put into the application's component, whereas the @Binds needs to be put into the activity's component. For example:
// This should be installed into the Application's @Component.modules
@Module
abstract class LoginUiInjectorModule {
@ContributesAndroidInjector(modules = LoginUiModule.class)
abstract LoginUI provideLoginUI();
// This should be installed into the LoginUI @ContributesAndroidInjector.modules
@Module
abstract class LoginUiModule {
@Binds abstract AccountView.LoginView provideLoginView(LoginUI loginUI);
It's difficult to say without having a real example to debug, but one issue I see is that the @Binds is in the same module as the ContributesAndroidInjector, as shown below.
@Module
public abstract class AccountViewModule {
@ContributesAndroidInjector()
abstract LoginUI provideLoginUI();
@Binds abstract AccountView.LoginView provideLoginView(LoginUI loginUI);
However, I think these need to be in separate modules because the @ContributesAndroidInjector needs to be put into the application's component, whereas the @Binds needs to be put into the activity's component. For example:
// This should be installed into the Application's @Component.modules
@Module
abstract class LoginUiInjectorModule {
@ContributesAndroidInjector(modules = LoginUiModule.class)
abstract LoginUI provideLoginUI();
// This should be installed into the LoginUI @ContributesAndroidInjector.modules
@Module
abstract class LoginUiModule {
@Binds abstract AccountView.LoginView provideLoginView(LoginUI loginUI);
Thank you very much @bcorso