Код: Выделить всё
error: [Dagger/MissingBinding] com.example.core.api.service.AlertMainService cannot be provided without an @Provides-annotated method.В какой-то момент я просто решил попробовать еще раз очистить проект и нажать кнопку Выполнить, чтобы запустить его на своем устройстве... и это сработало. !
Но почему??? Почему я могу собрать его и запустить на устройстве, но не пересобрать?
К сожалению, я не могу просто игнорировать эту проблему, поскольку она также не будет должным образом встроена в нашу CI.
В модуле это выглядит так:
Код: Выделить всё
@Module
@InstallIn(SingletonComponent::class)
class NetworkModule {
@Singleton
@Provides
fun provideAlertMainService(
alertAuthenticationInterceptor: AlertAuthenticationInterceptor,
hostSelectionInterceptor: HostSelectionInterceptor,
prefs: SharedPrefs
): AlertMainService {
...
}
Код: Выделить всё
@Singleton
@Provides
fun provideAlertService(
alertAuthenticationInterceptor: AlertAuthenticationInterceptor,
hostSelectionInterceptorAlert: HostSelectionInterceptorAlert,
prefs: SharedPrefs
): AlertService {
...
}
Класс, в который я их внедряю, выглядит так:
Код: Выделить всё
@Singleton
class AlertRepository @Inject constructor(
private val alertService: AlertService,
private val alertMainService: AlertMainService
) {
...
}
Это какая-то ошибка с Hilt? В чем тут дело?
Подробнее здесь: https://stackoverflow.com/questions/789 ... tton-works
Мобильная версия