https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
koin
  • m

    Marius Kotsbak

    01/25/2021, 2:17 PM
    Hi! Why can't Koin search for classes registered for DI that implement an interface that is required by some other component?
    f
    a
    • 3
    • 7
  • t

    Tony Kazanjian

    01/27/2021, 8:36 PM
    Hello! I'm wondering if anyone could elaborate on the differences between the AndroidX package 
    org.koin:koin-androidx-viewmodel:$koin_version
     versus just the basic 
    org.koin:koin-android-viewmodel:$koin_version
    . I have been using the latter with ViewModels from the AndroidX lifecycle package and everything is working just fine. What would I need the AndroidX Koin dependency for?
    j
    • 2
    • 2
  • a

    arnaud.giuliani

    02/01/2021, 3:56 PM
    will help merge and better manage all docs
    👍 1
    v
    • 2
    • 2
  • c

    chi

    02/04/2021, 4:44 PM
    I'm getting this error when I try to build my KMM project
    Incompatible Kotlin/Native libraries
    				There are 2 third-party libraries attached to the project that were compiled with an older Kotlin/Native compiler and cant be read in IDE:
    				Gradle: org.koin:koin-core-metadata:darwinMain:3.0.0-alpha-4
    				Gradle: org.koin:koin-core-metadata:nativeMain:3.0.0-alpha-4
    				Please edit Gradle buildfile(s) and specify library a version compatible with Kotlin/Native 1.4.30-RC. Then re-import the project in IDE.
    I'm using AS 4.1.2 and the Kotlin version
    1.4.30-RC
    , any way I can fix this?
    a
    j
    • 3
    • 16
  • m

    Mark

    02/06/2021, 2:59 AM
    I noticed the docs still mention jcenter(). Is there an alternative repository to use? https://insert-koin.io/docs/quickstart/kotlin/ EDIT: I just noticed https://github.com/InsertKoinIO/koin/issues/1004
    👍 1
    a
    • 2
    • 2
  • c

    Cyril Find

    02/11/2021, 1:00 PM
    hi, posting this issue cause I think everyone trying to update to compose alpha12 will have it: https://github.com/InsertKoinIO/koin/issues/1006
    a
    • 2
    • 2
  • i

    igor.wojda

    02/13/2021, 1:35 PM
    Is there any way to construct
    NavArgs
    on the fly and inject then directly into
    ViewModel
    ?
    t
    a
    • 3
    • 10
  • g

    gammax

    02/15/2021, 7:46 PM
    Sharing it here as it’s relevant for people in this channel 🙂 https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1613409760212800
    ❤️ 4
    a
    • 2
    • 1
  • l

    LG

    02/22/2021, 11:54 AM
    Hello Is there a way to get androidContext() mocked in my module for a unit test ?
    p
    • 2
    • 2
  • a

    arnaud.giuliani

    02/24/2021, 10:45 AM
    new article: https://proandroiddev.com/understanding-android-scopes-with-koin-cfe6b60ca579
    👍 9
    👏 5
    t
    • 2
    • 6
  • f

    Fedora

    02/26/2021, 4:45 PM
    Hey folks, is it a bad practice to get the Fragment's Presenter (MVP arch) lazily via
    by inject
    like this:
    private val presenter: MySamplePresenter by inject { parametersOf(requireContext(), get()) }
    at the top of the Fragment? (not in lifecycle events like onViewCreated etc). Is this gonna cause a memory leak on screen rotation? (cause then fragment is retained during configuration change but view is destroyed and recreated)
    a
    t
    • 3
    • 2
  • g

    gabin

    02/26/2021, 6:26 PM
    hello guys. I’m trying to add koin gradle plugin
    classpath "org.koin:koin-gradle-plugin:3.0.0-alpha4"
    , but getting error
    m
    • 2
    • 1
  • g

    gabin

    02/26/2021, 6:36 PM
    is it being removed from koin? How can I check dependencies now
    ☝️ 1
    t
    • 2
    • 2
  • a

    arnaud.giuliani

    03/02/2021, 9:40 AM
    https://search.maven.org/search?q=io.insert-koin
    m
    e
    • 3
    • 7
  • a

    Alex

    03/04/2021, 3:47 PM
    How can a dependency be scoped to a sharedViewModel and then be injected into a non-shared viewModel?
    a
    • 2
    • 6
  • j

    Joseph Roffey

    03/09/2021, 2:15 PM
    Hey there, I’m attempting to migrate from 
    org.koin:koin-core:3.0.0-alpha-4
     to 
    io.insert-koin:koin-core:3.0.1-beta-1
      but I can no longer import 
    org.koin.core.get
    ,
    org.koin.core.KoinComponent
    or
    org.koin.core.inject
    , has anyone else seen this issue/know how to resolve it?
    ✅ 1
    🙌 1
    j
    • 2
    • 2
  • c

    chi

    03/09/2021, 4:43 PM
    I'm trying to also migrate to the 3.0.1 beta version but I'm getting errors. Any idea why this is?
    Failed to resolve: org.koin:koin-core:3.0.1-beta-1
    Failed to resolve: org.koin:koin-test:3.0.1-beta-1
    Failed to resolve: org.koin:koin-android:3.0.1-beta-1
    Failed to resolve: org.koin:koin-androidx-viewmodel:3.0.1-beta-1
    j
    • 2
    • 6
  • a

    arnaud.giuliani

    03/10/2021, 8:36 AM
    Hello all, just a reminder on Koin v3 setup: https://insert-koin.io/docs/setup/v3
    j
    • 2
    • 2
  • t

    tieskedh

    03/11/2021, 9:09 AM
    I can understand it very well that it can be out of the scope of the project, but maybe it's an idea to load properties from a properties-file from commonMain using the gradle-plugin?
    a
    • 2
    • 3
  • a

    aipok

    03/17/2021, 8:09 PM
    How should Compose elements that have injection work with
    @Preview
    annotation? For me it gives
    java.lang.IllegalStateException: KoinApplication has not been started
    because application isn’t started during
    compose preview
    🤔
    j
    p
    • 3
    • 2
  • d

    Dhaval Gondaliya

    03/25/2021, 5:27 AM
    does maven central repo with version 3.0.1-beta-2 is only for multiplatform? or can be used in android too? I have used new group id (
    io.insert-koin
    ) and it gives error in android studio for viewmodel
    a
    • 2
    • 3
  • c

    christophsturm

    03/26/2021, 8:18 PM
    I’m trying to run my test suite which uses koin multithreaded and it does not work as expected. I just want multiple koin instances to be independent from each other. this test illustrates the problem:
    @Test
        fun `multi instance koin`() {
            class User()
    
            val user = User()
    
            val myModule = module {
                single {user}
            }
            fun app()  = koinApplication { modules(myModule) }
            val koin1 = app()
            val koin2 = app()
    
            koin1.koin.get<User>()
            koin1.close()
            koin2.koin.get<User>()
    
    
        }
    t
    a
    • 3
    • 22
  • n

    nikolaymetchev

    03/30/2021, 9:25 AM
    Hi, I have just noticed that koin strips quotes out of environment variables.
    fun saveProperties(properties: Properties) {
            if (_koin.logger.isAt(Level.DEBUG)) {
                _koin.logger.debug("load ${properties.size} properties")
            }
    
            val propertiesMapValues = properties.toMap() as Map<String, String>
            propertiesMapValues.forEach { (k: String, v: String) ->
                saveProperty(k, v.quoted())
            }
        }
    v.quoted()
    is the culprit This makes it very hard to put JSON in environment variables and get it back such that parsers don’t complain! Why are quotes being stripped?
    a
    d
    • 3
    • 29
  • p

    pawegio

    04/01/2021, 7:53 AM
    Can I inject nullable
    DefinitionParameters
    to android
    ViewModel
    in koin? It fails when I try to and value is
    null
    (
    InstanceCreationException
    is thrown).
    a
    • 2
    • 4
  • o

    oday

    04/03/2021, 6:48 PM
    so
    jcenter()
    should be removed soon, doing so right now breaks the imports
    a
    • 2
    • 1
  • a

    aipok

    04/11/2021, 4:25 PM
    Weird that with
    3.0.1-beta-2
    the
    io.insert-koin:koin-androidx-compose
    isn’t discoverable. While with beta 1 it works just fine. Am I missed some changes to packages?
    a
    • 2
    • 1
  • s

    Slava Glushenkov

    04/17/2021, 2:33 PM
    Is there a right way to use Jetpack Compose Navigation components with Koin?
    a
    p
    • 3
    • 7
  • d

    dave08

    04/18/2021, 12:55 PM
    Just wondering, why wouldn't Koin have a logging wrapper like KotlinLogging does, with lambdas to provide the text only if that logging level is enabled? It would add much more value to the wrapper...
    a
    • 2
    • 8
  • d

    dave08

    04/21/2021, 11:32 AM
    Any short way to inject a child of:
    interface UseCase<in Request : Any> {
        suspend fun execute(request: Request): ServerResponse
    
        suspend operator fun invoke(request: Request): ServerResponse = execute(request)
    }
    in a ktor
    fun Route.someRoutes()
    using the `Request`'s type? I want to be able to provide an implementation in Unit tests without mocking the actual implementation for that route... and the
    Request
    object is unique for each
    UseCase
    ...
    a
    • 2
    • 3
  • f

    Fabio

    04/26/2021, 12:33 AM
    My personal opinion is that libraries shouldn't force application developers to use a specific DI/locator pattern. BTW is this a closed source lib? otherwise I'd ask you to reconsider.
    ➕ 1
    o
    a
    • 3
    • 4
Powered by Linen
Title
f

Fabio

04/26/2021, 12:33 AM
My personal opinion is that libraries shouldn't force application developers to use a specific DI/locator pattern. BTW is this a closed source lib? otherwise I'd ask you to reconsider.
➕ 1
o

oday

04/26/2021, 9:29 AM
yes this is just for me, a convenience library for all my other projects that i always happen to need similar dependencies in
a

arnaud.giuliani

04/26/2021, 10:13 AM
it’s open source
Koin should not impose any kind of writing/thinking
o

oday

04/26/2021, 10:28 AM
ok I see 👍🏻
View count: 5