Android 又一个",;找不到符号变量DaggerAppComponent“;
我最终进入了Dagger(2),通过以下方式为我的项目创建了尽可能少的附加内容: 当前服务模块:Android 又一个",;找不到符号变量DaggerAppComponent“;,android,dagger-2,Android,Dagger 2,我最终进入了Dagger(2),通过以下方式为我的项目创建了尽可能少的附加内容: 当前服务模块: @Module public class CurrencyServiceModule { @Provides @NonNull @Singleton public CurrencyService provideCurrencyService(){ return new CurrencyService(); } } @Component(mo
@Module
public class CurrencyServiceModule {
@Provides
@NonNull
@Singleton
public CurrencyService provideCurrencyService(){
return new CurrencyService();
}
}
@Component(modules = {CurrencyServiceModule.class})
public interface AppComponent {
void inject(ChargeDetailsFragment fragment);
}
AppComponent.java:
@Module
public class CurrencyServiceModule {
@Provides
@NonNull
@Singleton
public CurrencyService provideCurrencyService(){
return new CurrencyService();
}
}
@Component(modules = {CurrencyServiceModule.class})
public interface AppComponent {
void inject(ChargeDetailsFragment fragment);
}
和初始化:
public class AgentApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
component = buildComponent();
}
private AppComponent buildComponent(){
return DaggerAppComponent.builder()
.currencyServiceModule(new CurrencyServiceModule())
.build();
}
}
仍然没有生成DaggerAppComponent
已尝试针对此编译错误的常规建议,但没有结果。我认为这可能取决于我的注释定义,所以Dagger基本上不构建所需的代码。有没有办法通过查看匕首日志来了解发生了什么
更新:渐变配置:
compile 'com.google.dagger:dagger:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
构建项目时,出现了什么错误,请发布它/works/control android/control/src/main/java/co/getcontrol/ControlApplication.java错误:(475,16)错误:找不到符号变量DaggerAppComponent错误:任务执行失败:控制:compileAggregateIntegrationJavaWithJavac'>编译失败;有关详细信息,请参阅编译器错误输出。请删除此行并重新编译,或者查看此错误之前的情况,如果Dagger无法生成组件,这是因为它无法满足您需要的依赖项,它将告诉您问题出在何处。另外,请确保您已将Dagger的编译器添加到注释处理中。这可能是未生成类的原因。@elmorabea如何在gradle构建日志中找到Dagger失败的原因?我试过了,但找不到确切的位置