Karan Sharma
12/09/2024, 10:16 AMFatal Exception: java.lang.IllegalStateException
Koin context has not been initialized in rememberKoinApplication
Code:
import android.app.Application
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
instance = this
}
companion object {
var instance : Application? = null
}
}
I suspect the app is in background when this crash occurs. It is happening on One Plus device only though.arnaud.giuliani
12/09/2024, 1:06 PMKaran Sharma
12/09/2024, 11:11 PMoverride fun onCreate() {
super.onCreate()
instance = this
}
companion object {
var instance : Application? = null
}
arnaud.giuliani
12/10/2024, 2:23 PMKaran Sharma
12/10/2024, 8:39 PMAman Shaikh
09/15/2025, 5:29 PMfun App(
prefs: DataStore<Preferences>,
onAppStateChanged: (AppState) -> Unit = {}
) {
MaterialTheme(colorScheme = LIGHT_COLOR_SCHEME) {
KoinApplication(
application = {
modules(
module {
single<DataStore<Preferences>> { prefs }
} + appModules
)
}
) {
arnaud.giuliani
09/16/2025, 12:25 PMarnaud.giuliani
09/16/2025, 12:26 PMKoinApplication(
application = {