【发布时间】:2021-07-14 02:15:42
【问题描述】:
我的问题与这个问题here 类似,在接受的答案中,该问题已在版本 2.31.2 中解决。但是警告对我来说仍然存在,我使用的是 2.37 版。其他答案对我来说仍然不清楚(实际上并未确认发生了什么)。这是我的 ViewModel 代码:
@HiltViewModel
class DetailViewModel @Inject constructor(
private val context: Context,
private val repository: VaccineRepository,
) : ViewModel() {
这是提供功能:
@Singleton
@Provides
fun provideApplicationContext(
@ApplicationContext appContext: Context
): Context = appContext
它确实有效,但警告让我感到困扰。那么,这只是错误的警告,我可以压制它还是真的泄漏了?
【问题讨论】:
标签: android kotlin dagger-hilt