Home > Enterprise >  How to add Koin to Ktor project
How to add Koin to Ktor project

Time:07-26

I am trying to install "Koin" for DI. I have added the Koin dependency to my gradle but it doesn't seem to install.

implementation("io.insert-koin:koin-core:3.2")

implementation("io.insert-koin:koin-ktor:3.2")

This is my plugin method

fun Application.configureDependencyInjection(){
    install(Koin) {
       /*
         My modules are meant to go in here.
       */
    }
}

However, I keep getting this error: "Unresolved reference: Koin"

CodePudding user response:

Try with this:

// Koin for Kotlin apps
    implementation "io.insert-koin:koin-core:3.2.0"
    // Testing
    testCompileOnly("io.insert-koin:koin-test:3.2.0")

it works for me.

CodePudding user response:

I was able to resolve the issue by invalidating cache. I suppose it was a cache issue.

  • Related