admin管理员组

文章数量:1122832

I have an android app, that when closed, if I click on a specific pop up message, I get navigated to the splash screen. From there I get navigated to the home screen, and conditionally (checking if I came here from a pop up message) to the survey screen.

When I nav back from the survey activity to the home screen (fragment), I get the below error

org.koin.core.error.NoBeanDefFoundException: No definition found for type 'gr.avin.home.presentation.tabs.offers.OffersViewModel'. Check your Modules configuration and add missing type and/or qualifier!

OffersViewModel is part of the home fragment's tabLayout

class OffersViewModel(
    @MainDispatcher
    private val mainDispatcher: CoroutineDispatcher,
    @DefaultDispatcher
    private val defaultDispatcher: CoroutineDispatcher,
    private val getOffersUseCase: GetOffersUseCase,
    private val getOfferUseCase: GetOfferUseCase,
    private val observeProfileUseCase: ObserveProfileUseCase,
    private val offerDetailsMapper: OfferDetailsMapper
) : ViewModel() {

...
}

class OfferDetailsActivity : BaseKoinActivity<ActivityOfferDetailsBinding>(homeKoinModule) {

    private val viewModel: OffersViewModel by viewModel()

...
}

class OffersFragment : BaseFragment<FragmentOffersBinding>(), ViewPagerFragmentVisibility {

    private val viewModel: OffersViewModel by sharedViewModel()
    private val navController: NavController by lazy { findNavController() }
    private var offersListAdapter: OffersListAdapter? = null

...

}

Below is my related module

val homeKoinModule = module {

...

viewModel {
        OffersViewModel(
            mainDispatcher = get(named<MainDispatcher>()),
            defaultDispatcher = get(named<DefaultDispatcher>()),
            getOffersUseCase = get(),
            getOfferUseCase = get(),
            observeProfileUseCase = get(),
            offerDetailsMapper = get()
        )
    }

...
}

I literally cannot find anything wrong. Any help?

本文标签: androidKoin NoBeanDefFoundException when navigating back from an activityStack Overflow