Not possible to add non-Android module to Android Koin
See original GitHub issueHi there! Thanks for your hard work on Koin! Great library.
Anyway, I faced an issue, where you force to provide list of AndroidModule
’s to Application.startKoin()
. Thus it is impossible to provide modules that are built, for example, in data or domain layers, which are usually written without platform dependencies.
Briefly looking through your code, I haven’t found any serious reason to force AndroidModule
for android
artifact. What do you think? This will be a big win, if your android
artifact’s startKoin
function will accept all descendants of Module
.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Isolate Koin Within an Android Module | by Elye - Medium
1. Repeated startKoin is not allowed. The normal way to start Koin is to use startKoin as below. startKoin { modules(myModule) }.
Read more >Managing Android Scopes | Koin
Working with the Android lifecycle. Android components are mainly managed by their lifecycle: we can't directly instantiate an Activity nor a Fragment. The ......
Read more >Trying to use koin but doesnt work correctly on android
I dont know, why koin is not able to suggest org.koin.android.ext.android.inject path when using by inject() but I fixed this issue with ...
Read more >Applying Koin - CommonsWare
For example, you can use Koin for non-Android projects using Kotlin. In our case, we are using koin-androidx-viewmodel : implementation "io.insert-koin: ...
Read more >Dependency Injection With Koin - RayWenderlich.com
In this tutorial, you'll get to know Koin, one of the most popular new frameworks for dependency injection.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello,
Koin 0.7.0 brings a better DSL and Koin modules won’t have any dependency with Android classes. Up to you to inject Application/Context dependencies or not.
The
startKoin()
from 0.7.0 will acceptModules
as you pointed, allowing to build fully independent modules for Android.Wait the next days, for the next release (hope to release it before xmas 😃 )
You can check the Koin 0.7.1 on https://insert-koin.io