假设我有
// this class lives in the release (variant) directory
@HiltAndroidApp
open class MyParentApplication : Application() {
// some injection here
}
// this class lives in the debug (variant) directory
@HiltAndroidApp
class MyChildApplication : MyParentApplication {
// some debug only injection here. Debug injections won't be available as part of any app releases
// use debug only injections to do debug only actions
}
当我尝试执行上述操作时,我会收到一些与 Daggererror: cannot find symbol
相关的错误。但是,当我@HiltAndroidApp
从中删除时MyParentApplication
,一切都编译得很好。显然,我不能这样做,因为 Dagger 注入在发布版本上不起作用。什么是适当的 Hilt 设置来注入派生/子类?