错误:@dagger.android.ContributesAndroidInjector,但找不到 dagger.android.processor.AndroidProcessor
2022-09-02 11:11:58
我正在尝试设置Dagger 2.12,但我收到此错误:
错误:@dagger.android.ContributesAndroidInjector 已被使用,但在处理器路径上找不到 dagger.android.processor.AndroidProcessor
以下是我配置 Dagger 的方法:
我的应用程序类:
public final class App extends android.app.Application implements HasActivityInjector {
@Inject
DispatchingAndroidInjector<Activity> activityInjector;
@Override
public void onCreate() {
super.onCreate();
DaggerAppComponent.builder().build().inject(this);
}
@Override
public AndroidInjector<Activity> activityInjector() {
return activityInjector;
}
}
活动绑定模块:
@Module
public abstract class ActivityBindingModule {
@ContributesAndroidInjector(modules = SearchActivityModule.class)
abstract SearchActivity searchActivity();
}
搜索活动模块:
@Module
public class SearchActivityModule {
@Provides
public SearchActivityDelegate getDelegate(SearchActivity searchActivity) {
return searchActivity;
}
@Provides
public SearchActivityPresenter providePresenter(SearchActivity searchActivity) {
return new SearchActivityPresenter(new OtherDependency(), searchActivity);
}
}
应用程序模块:
@Module(includes = { AndroidInjectionModule.class, ActivityBindingModule.class })
public abstract class AppModule {
}
有谁知道可能导致此错误的原因是什么?