Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [android-koin]

The tag has no usage guidance.

android-koin
0 votes
0 answers
6 views

Can Koin inject view models with a key, like ViewModelProvider.get()?

Is there an equivalent to this in Android Koin? val viewModel = ViewModelProvider(fragment, factory).get( key = "unique_key_goes_here", modelClass = MyViewModel::class.java ) That ...
Barry Fruitman's user avatar
0 votes
1 answer
29 views

Koin - using scopes in isloated context when building a library with koin

I am using koin in an SDK, i create an isolated koin context as explained in the docs, however, i want to allow the SDK consumer to turn the SDK off, effectively clearing all classes created by the ...
Ziv Kesten's user avatar
  • 1,222
1 vote
0 answers
47 views

How to create a deep link in an app made with android compose if i don't have a website for my app

I am creating an app that should enable the users to share their profile or posts through links. The user should be able to (by pressing a share button) create a content specific link for any of his/...
Theiplusminus's user avatar
0 votes
1 answer
62 views

Koin: getting instance of viewmodel from parent fragment using an interface/abstract class

I've declared an abstract viewModel (let's say AnimalsViewModel), two viewModels extend it (DogViewModel, CatViewModel) the corresponding fragments (DogFragment, CatFragment) host a common fragment (...
jack_the_beast's user avatar
1 vote
0 answers
160 views

Passing a context using koin annotations missing Definition type

I have the following module where I am creating sharepreferences @Module @ComponentScan class SharedPreferenceModule { companion object { private const val FILE_NAME = "...
ant2009's user avatar
  • 23.3k
0 votes
0 answers
16 views

Unable to call my function within my viewmodel injected in my fragment with koin

I am implementing an android application using koin injection . I have implemented a function within a viewModel injected in my fragment using koin but when i call the function in my fragment , it ...
Patrick Renaud's user avatar
0 votes
1 answer
149 views

Inject Usecases with having more than one parameter using andorid koin dependency injection

i was trying to inject usecase with having one parameter using koin dependency injection, and got error Cannot create an instance of class viewmodel, could you please help me how to inject such ...
Rajan Nalawade's user avatar
1 vote
0 answers
210 views

ViewModel Singleton With Koin

One of the objects that I am trying to inject captures a references in a lambda. That lambda is used as a callback to update my viewModel. How can I use koin to inject that object? Working code that ...
Miguel Vila Ojito's user avatar
-1 votes
1 answer
164 views

Android jetpack compose get updated value from class property

I am very beginner in android compose and kotlin, I have this code using FusedLocationProviderClient, to get the user permission and enable locations, however I can't set the Lat and long values to ...
rashidnk's user avatar
  • 4,262
0 votes
1 answer
45 views

Testing Koin viewmodel: Cannot invoke setValue on a background thread

Trying to create JUnit test for Viewmodel using Koin DI. Running the first test I've got this issue: Cannot invoke setValue on a background thread. So how should I test Viewmodel correctly? Test: ...
Konstantin Konopko's user avatar
0 votes
0 answers
19 views

No definition found for class:'com.subbu.unittestsample.TestUtil2'. Check your definitions

I am trying to write a unit test cases for one of the KoinComponent class but I am getting the below error org.koin.core.error.NoBeanDefFoundException: No definition found for class:'com.subbu....
subrahmanyam boyapati's user avatar
0 votes
0 answers
128 views

Koin variables initialisation on multi Module project

I am converting my whole project into Koin. Using Koin KMP (I am converting right now my shared module). And I have multiple modules, that are being executed in one main module (which the main ...
Reborned BBIAJ's user avatar
0 votes
1 answer
292 views

Android Koin+Compose - Is it possible to inject a Composable View

I have a structure today where my Screen Injects widgets, created as Fragments, from other Modules, using named references from Koin. Something like this: val view2 by inject<Fragment>(named(...
Gustafah88's user avatar
1 vote
0 answers
57 views

How to correctly define the Android StorageManager when using Koin's checkModules Test

I'm having issues running Koin's checkModules from JVM unit test. I cannot figure out the correct way to define/mock the Android's StorageManager as part of checking the modules. Using Koin 3.4.3. I'm ...
scottyab's user avatar
  • 23.9k
1 vote
1 answer
673 views

Using Koin for Ktor-Client in Android: Missing type 'io.ktor.client.engine.HttpClientEngine'

I could use some help understanding why this module for a ktor client fails - fun provideKtorClient() = HttpClient(OkHttp) { install(ContentNegotiation) { json() } } val ktorModule = ...
Offbeat Upbeat's user avatar

15 30 50 per page