Android 如何为调试构建包含Dagger调试子模块?

Android 如何为调试构建包含Dagger调试子模块?,android,dagger-2,dagger,Android,Dagger 2,Dagger,我正在我的应用程序中创建一个Dagger AppComponent,如下所示 protected AppComponent createComponent() { return DaggerAppComponent.builder().appModule(new AppModule(this)).build(); } AppModule包括一个功能模块,如下所示 @Module(includes = {FeatureModule.class}) public class AppModu

我正在我的应用程序中创建一个Dagger AppComponent,如下所示

protected AppComponent createComponent() {
    return DaggerAppComponent.builder().appModule(new AppModule(this)).build();
}
AppModule包括一个功能模块,如下所示

@Module(includes = {FeatureModule.class})
public class AppModule {
   // All the provides here
}
@Singleton
@Component(modules = {AppDebugModule.class})
public interface AppDebugComponent extends AppComponent {
    // Inject
}
现在,我计划在FeatureModule中有一个单独的调试构建项。因此,我创建了从FeatureModule继承的FeatureDebugModule

@Module
public class FeatureDebugModule extends FeatureModule {

    @Override
    protected void debugBuildSpecificConfig() {
         // Something specific to debug
    }
}
有了它,我还从AppModule继承创建了AppDebugModule

@Module(includes = {FeatureDebugModule.class})
public class AppDebugModule : AppModule {
}
最后,我制作了一个AppDebugger应用程序,用于设置Dagger组件,如下所示

protected AppComponent createComponent() {
    return DaggerAppComponent.builder().appModule(new AppDebugModule(this)).build();
}

不知何故,代码在我的调试模式下无法访问
FeatureDebugModule
,但仍在
FeatureModule
代码上。我做错了什么?

显然,对于Dagger,加载的模块基于组件模块中定义的内容。因此,在调试中,我使用如下方法

@Module(includes = {FeatureModule.class})
public class AppModule {
   // All the provides here
}
@Singleton
@Component(modules = {AppDebugModule.class})
public interface AppDebugComponent extends AppComponent {
    // Inject
}
以及匕首组件的创建

DaggerAppDebugComponent.builder().appDebugModule(new AppDebugModule(this)).build();
DaggerAppReleaseComponent.builder().appReleaseModule(new AppReleaseModule(this)).build();
在发行版中,我使用了如下

@Singleton
@Component(modules = {AppReleaseModule.class})
public interface AppReleaseComponent extends AppComponent {
    // Inject
}
以及匕首组件的创建

DaggerAppDebugComponent.builder().appDebugModule(new AppDebugModule(this)).build();
DaggerAppReleaseComponent.builder().appReleaseModule(new AppReleaseModule(this)).build();
您是如何定义“AppDebugApplication”的?