3

将 Dagger-android 更改为 Hilt 后,出现以下错误。

  @Provides @Singleton @org.jetbrains.annotations.NotNull retrofit2.converter.gson.GsonConverterFactory com.zhixin.wedeep.common.di.NetWorkModule.provideGsonConverterFactory(com.google.gson.Gson)
  @Provides @Singleton @org.jetbrains.annotations.NotNull com.google.gson.Gson com.zhixin.wedeep.common.di.NetWorkModule.provideGson()
  @Singleton @Provides @org.jetbrains.annotations.NotNull com.zhixin.wedeep.homepage.data.dao.CommentDao com.zhixin.wedeep.homepage.data.di.HomePageDataModule.provideCommentDao(com.zhixin.wedeep.homepage.data.HomePageDatabase)
  @Singleton @Provides @org.jetbrains.annotations.NotNull com.zhixin.wedeep.homepage.data.HomePageDatabase com.zhixin.wedeep.homepage.data.di.HomePageDataModule.provideHomePageDatabase(android.app.Application)
  @Singleton @Provides @org.jetbrains.annotations.NotNull com.zhixin.wedeep.homepage.data.dao.CompositionDao com.zhixin.wedeep.homepage.data.di.HomePageDataModule.provideCompositionDao(com.zhixin.wedeep.homepage.data.HomePageDatabase)
  @Singleton @Provides @org.jetbrains.annotations.NotNull com.zhixin.wedeep.homepage.data.dao.CompositionsDao com.zhixin.wedeep.homepage.data.di.HomePageDataModule.provideBriefCompositionDao(com.zhixin.wedeep.homepage.data.HomePageDatabase) [com.zhixin.wedeep.main.App_HiltComponents.ApplicationC �� com.zhixin.wedeep.main.App_HiltComponents.ActivityRetainedC �� com.zhixin.wedeep.main.App_HiltComponents.ActivityC]

谁对这个问题有想法?

4

1 回答 1

7

我也是 HILT 的新手,我遇到了这种错误。我猜你用@Singleton 提供对象请删除这个注释

于 2020-07-15T09:46:30.827 回答