error: [Dagger/MissingBinding] java.util.ArrayList<java.lang.Integer> cannot be provided without an @Inject constructor or an @Provides-annotated meth

error: [Dagger/MissingBinding] java.util.ArrayList<java.lang.Integer> cannot be provided without an @Inject constructor or an @Provides-annotated meth

错误:

error: [Dagger/MissingBinding] java.util.ArrayList<java.lang.Integer> cannot be provided without an @Inject constructor or an @Provides-annotated method.
  public abstract static class SingletonC implements HiltWrapper_ActivityRetainedComponentManager_LifecycleComponentBuilderEntryPoint,

   javax.inject.Provider<java.util.ArrayList<java.lang.Integer>> is injected at
          space.rodionov.swedishdriller.DrillerViewModel_AssistedFactory(�, drillerCatList, �)
      space.rodionov.swedishdriller.DrillerViewModel_AssistedFactory is injected at
          space.rodionov.swedishdriller.DrillerViewModel_HiltModule.bind(factory)
      java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>> is injected at
          androidx.hilt.lifecycle.ViewModelFactoryModules.ActivityModule.provideFactory(�, viewModelFactories)
      @dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory java.util.Set<androidx.lifecycle.ViewModelProvider.Factory> is requested at
          dagger.hilt.android.internal.lifecycle.DefaultViewModelFactories.ActivityEntryPoint.getActivityViewModelFactory() [space.rodionov.swedishdriller.SwedishDrillerApplication_HiltComponents.SingletonC ? space.rodionov.swedishdriller.SwedishDrillerApplication_HiltComponents.ActivityRetainedC ? space.rodionov.swedishdriller.SwedishDrillerApplication_HiltComponents.ActivityC]
  The following other entry points also depend on it:
      dagger.hilt.android.internal.lifecycle.DefaultViewModelFactories.FragmentEntryPoint.getFragmentViewModelFactory() [space.rodionov.swedishdriller.SwedishDrillerApplication_HiltComponents.SingletonC ? space.rodionov.swedishdriller.SwedishDrillerApplication_HiltComponents.ActivityRetainedC ? space.rodionov.swedishdriller.SwedishDrillerApplication_HiltComponents.ActivityC ? space.rodionov.swedishdriller.SwedishDrillerApplication_HiltComponents.FragmentC][WARN] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC).

此错误发生在构建项目并试图启动它的过程中。 它发生在我完成 ViewModel 代码并从 Fragment 调用它的方法之后。 在我看来,我在 ViewModel 中犯了错误,但 Hilt 对我来说是新的,也是 Kotlin 语言。 感谢您的帮助。 代码:

在片段中:

@AndroidEntryPoint
class DrillerFragment : Fragment(R.layout.cardstack_layout), CardStackListener {

    private val viewModel: DrillerViewModel by viewModels()

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val binding = CardstackLayoutBinding.bind(view)
        val drillerLayoutManager = CardStackLayoutManager(requireContext(), this) // ЧТО ПИСАТЬ В CONTEXT??
        val drillerAdapter = DrillerAdapter()
        binding.apply {
            cardStackView.apply {
                adapter = drillerAdapter
                layoutManager = drillerLayoutManager
                itemAnimator = null 
            }
        }

        viewModel.getLivedataList().observe(viewLifecycleOwner) {
            drillerAdapter.submitList(it)
        }
        viewModel.get4words()
    }

在视图模型中:

class DrillerViewModel @ViewModelInject constructor(
    private val wordDao: WordDao,
    val drillerCatList: ArrayList<Int> = ArrayList(),
    val mLivedataList: MutableLiveData<List<Word>>
) : ViewModel() {

    val shownCategoriesFlow = wordDao.getShownCategoriesNumbers()

    fun getLivedataList(): LiveData<List<Word>> {
        return mLivedataList
    }

    fun get4words() = viewModelScope.launch {
        shownCategoriesFlow.collect {
            it.forEach { catNumber ->
                drillerCatList.add(catNumber)
            }
        }
        wordDao.get4words(drillerCatList).collect {
            mLivedataList.value = it
        }
    }
}

在构造函数中创建你的变量

    val drillerCatList: ArrayList<Int> = ArrayList(),
    val mLivedataList: MutableLiveData<List<Word>>

作为 class 中的普通变量,如果您不通过 Hilt 注入它们