Questions tagged [kodein]

For questions regarding the libraries of the Kodein Framework (a Kotlin/Multiplatform architecture component framework). Questions should specify which library is being asked about (DI, DB, Log, etc.) as well as the source-set in which the problem occurs (Android, Native, Common, etc.).

The Kodein Framework

The Kodein Framework provides several libraries that can be used independently or together. Each provides an opinionated architecture component to ease and accelerate Kotlin/Multiplatform applications.

Links:

Tag usage

When posting questions about Kodein libraries, please make sure to include:

  • The source-set where the issue arises (common, intermediate, platform).
  • The target system & compiler (Android, JVM, JS, Native).
  • Kotlin version.
89 questions
2
votes
0 answers

NoClassDefFoundError: Failed resolution of: View::OnUnhandledKeyEventListener

I get following error log, but I can run my app. com.example.simplekodein I/zygote64: Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError:…
Tranquillo
  • 235
  • 2
  • 13
2
votes
5 answers

how to inject dependency outside activity or fragment in Kodein or Koin?

want to initialize interface in a non activity or fragment class with Kodein DI Android sample shows only hot to use Kodein inside activity, but not on the other parts class MainViewModel() : KodeinAware{ override val kodein by closestKodein() …
Nurseyit Tursunkulov
  • 8,012
  • 12
  • 44
  • 78
2
votes
1 answer

How dependency graph works in Koin or Kodein?

I have Android/kotlin multi-module project. Some of my modules are Singletone, such as Network and Analytics modules. They need Application context in order to be initialized. I am able to initialize Koin/Kodein in app module. However, the problem…
Hesam
  • 52,260
  • 74
  • 224
  • 365
2
votes
0 answers

How to inject transient dependency factory with Kodein?

I wanna use ViewModelProvider Factory to inject custom parcelable data from intent (ie: Club). val teamModule = Kodein.Module { bind("team-factory") with factory { club: Club -> TeamListViewModelFactory(club, instance())…
2
votes
2 answers

How to inject test overrides into the default dependency graph?

I would like to inject mocked overrides into my Android instrumentation tests using Kodein. I don't know which is the optimal approach to do this. Here's what I have in mind: My app uses a KodeinAware application class. The served Kodein instance…
david.schreiber
  • 3,851
  • 2
  • 28
  • 46
2
votes
1 answer

With Kodein dependency injection, I don't want to pass around kodein instances everywhere

Using Kodein, I find I have to pass kodein instances around or inject them into modules and classes. But sometimes I have classes that are so disconnected I want them just to be able to discover "one true Kodein". Since this is a server side app,…
Jayson Minard
  • 84,842
  • 38
  • 184
  • 227
1
vote
1 answer

After adding these many dependencies project not responding

Build.gradle(Module:app) plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' id 'kotlin-kapt' } android { namespace 'com.protocol.mvvmshoppinglist' compileSdk 33 defaultConfig { applicationId…
1
vote
1 answer

Ktor / Kodein - How to write Integration Tests

Currently I write a small demo-app which uses Ktor as its Application Environment and Kodein as the Dependency Injection Framework. During the initialization of the Application I do import some modules, one of those I would like to replace during…
triplem
  • 1,324
  • 13
  • 26
1
vote
1 answer

org.kodein.di.Kodein$NotFoundException: No binding found for bind() with ?().? { ? }

Iam doing a project with objectbox + retrofit + kodein. But I'm getting this error. org.kodein.di.Kodein$NotFoundException: No binding found for bind() with ?().? { ? } KodeinApplication.kt class KodeinApplication :…
DSP
  • 11
  • 1
1
vote
1 answer

How do i fix this Kodein error: Expression 'kodein' cannot be invoked as a function. The function 'invoke()' is not found

Here is the full error : e: C:\Users\HP\AndroidStudioProjects\MoneyManager\app\src\main\java\com\cruxrepublic\moneymanager\ui\auth\LoginActivity.kt: (22, 28): Expression 'kodein' cannot be invoked as a function. The function 'invoke()' is not…
daniel_c
  • 63
  • 2
  • 10
1
vote
3 answers

Kodein Framework - property delegate must have a provideDelegate(...) method

I'm trying to build an app with the following architecture: LoginActivity -> MainActivity -> everything else handled in fragments hosted by MainActivity. I'm also using the Kodein Framework for the first time and get the following error in my…
susosaurus
  • 459
  • 10
  • 28
1
vote
1 answer

Inject Saved State in ViewModelFactory with kodein

I develop app with MVVM pattern. I want save UI when user rotate screen. MyViewModel.kt class MyViewModel(val repository: SomeRepository, state : SavedStateHandle) : ViewModel() { private val savedStateHandle = state …
1
vote
1 answer

How to inject retrofit service with Firebase ID Token into kodein

I'm trying to inject a retrofit service into kodien. The API service uses Firebase Auth token for authenticating. So I've to pass the id token in request header as basic auth by the getting the token from Firebase Auth.getInstance().getIdToken()…
varun
  • 300
  • 4
  • 10
1
vote
1 answer

Android Pass Context in object

I need to pass the Application Context to an object. This is to call a function to intercept in the okhttpClient, my connection service. I'am using an object class to build the connection to the server with retrofit and an external interface with my…
Hernâni Pereira
  • 312
  • 4
  • 19
1
vote
0 answers

Kodein: Retrieve bindings in FirebaseMessagingService

I have a class that should process all notifications and therefore extends FirebaseMessagingService: class DefaultFCMHandler(): FirebaseMessagingService(), FCMHandler, KodeinAware { private val _kodein: Kodein by closestKodein() override…
F.M.F.
  • 1,929
  • 3
  • 23
  • 42