question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not possible to add non-Android module to Android Koin

See original GitHub issue

Hi 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
arnaudgiulianicommented, Dec 18, 2017

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 accept Modules 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 😃 )

0reactions
arnaudgiulianicommented, Dec 20, 2017

You can check the Koin 0.7.1 on https://insert-koin.io

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found