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

Questions tagged [koin]

Koin is a Dependency Injection framework for Kotlin developers.

0 votes
0 answers
7 views

What would be the behaviour of singleton class if declared as factory in koin

When you declare an object class, Kotlin ensures that only one instance of that class exists throughout the application's lifecycle .But what will happen if we declare the same object class as factory ...
Sathrya Selvin's user avatar
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
0 answers
18 views

KOIN + KTOR + EXPOSED: test mocking

How am I supposed to mock DB in tests using technologies mentioned in question? None of my solutions work. The code below returns weird error: database org.jetbrains.exposed.sql.Database@134ff8f8 don'...
fghf's user avatar
  • 1
1 vote
1 answer
70 views

Koin: inject object returned by suspend function

I have object which created by suspend function like: suspend fun someSuspendFunction(): MyPreciousObject And I need to provide it for later injection using koin, like: val myModule = module { ...
Barmaley's user avatar
  • 16.4k
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
0 votes
0 answers
25 views

Replacing Koin declarations for Ktor Applications

I'm trying to write a REST-API using Ktor and Koin. I already wrote the authentication part, but when I wonted to test it I couldn't get Koin to replace the user repository implementation, my Ktor app ...
kefomo's user avatar
  • 47
0 votes
0 answers
40 views

Ocasional Android app crash at appModule (maybe Koin)

Ocasional application crashes were observed at "appModule". After I version-up Koin as below, same crash is not obeseved anymore. ・koin-core 3.2.2 ⇒ 3.4.0 ・koin-android 3.3.0 ⇒ 3.4.0 I am ...
Hiro o Matsuda's user avatar
1 vote
0 answers
59 views

RuntimeError: Illegal cast in Kotlin Multiplatform with Decompose and Koin on Web/Wasm target

I'm trying to run a Kotlin Multiplatform project on the Web/Wasm target. Koin version: 3.6.0-wasm-alpha2. An error occurs when invoking a factory method to create the Decompose rootComponent. It works ...
Yeldar Nurpeissov's user avatar
0 votes
0 answers
15 views

Reusing PagingSource in Paging3

In Paging3 I encountered the problem that it is necessary to create a new instance of PagingSource each time. I cannot understand how to implement this properly. I found information on Google that you ...
Егор Логинов's user avatar
1 vote
1 answer
78 views

How to solve "org.koin.core.error.InstanceCreationException: Could not create instance for '[Singleton:']'" in Kotlin Multiplaform

I am developing SDK using Kotlin Multiplatform The functionality we want to develop is check internet connectivity and write some unit test cases for implementation we are using MVVM architecture ...
Priyanka Kadam's user avatar
0 votes
0 answers
19 views

getOriginalKotlinClass returns null even though the class exists

I'm working on a Kotlin Multiplatform app with multiple modules. I use Koin for dependency injection. This is the structure of the project: MyApp ├── ... └── shared ├── injection └── modulea ...
Raahs's user avatar
  • 78
0 votes
0 answers
19 views

kmpnotifier throws an error when using two types of koin -> koin core and koin compose

I need koin compose to perform inject viewmodels - > for example @Composable fun SplashActivityContent( viewModel: SplashViewModel = koinInject() ) { } but since I want to use the kmpNotifier ...
Роман Маринов's user avatar
0 votes
0 answers
24 views

Koin is unable to resolve the Android context when the app is run outside of the emulator or USB debugging

I am developing an android application which works on emulator fine also when I connect my phone using USB cable it runs perfectly but when I disconnect the USB cable and try to run the debug version ...
nima's user avatar
  • 3
1 vote
1 answer
51 views

AndroidView of compose gives:: error No view found for id 0x7f0a01d2

I have been using Jetpack Compose and koin. I am facing error as below java.lang.IllegalArgumentException: No view found for id 0x7f0a01d2 (com.pyronixhc2.android.app:id/fragment_container_view) for ...
amity's user avatar
  • 960
2 votes
0 answers
143 views

Dependency Injection for DataStore with Koin

I have Compose multiplatform project that implement datastore. I use multiplatform datastore as reference. I have problem when injecting the data store. commonMain : fun getDataStore(producePath: () -&...
annng's user avatar
  • 25

15 30 50 per page
1
2 3 4 5
35