在使用Hilt作为依赖注入框架时,我尝试将我的特征模块作为动态特征模块。但是,我收到了以下异常:
caused by: java.lang.ClassCastException: com.android.sample.viaplay.DaggerViaplayApplication_HiltComponents_SingletonC$ActivityRetainedCImpl$ActivityCImpl$FragmentCI cannot be cast to com.android.sample.viaplay.feature.list.ui.DashboardFragment_GeneratedInjector
at com.android.sample.viaplay.feature.list.ui.Hilt_DashboardFragment.inject(Hilt_DashboardFragment.java:104)
at com.android.sample.viaplay.feature.list.ui.Hilt_DashboardFragment.onAttach(Hilt_DashboardFragment.java:55)
at androidx.fragment.app.Fragment.onAttach(Fragment.java:1783)
at com.android.sample.viaplay.feature.list.ui.Hilt_DashboardFragment.onAttach(Hilt_DashboardFragment.java:43)
我在另一个示例中使用了Dagger而不是Dagger-Hilt,并且它按预期工作:https://github.com/alirezaeiii/SampleDaggerRx 是否可以使用动态功能模块和Hilt?如果可以,如何解决上述异常。您可以在此处找到我的源代码:https://github.com/AliRezaeiii/Hilt-MultiModule-Cache