-
-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KoinAppAlreadyStartedException after changing theme #1840
Comments
You initializing Koin inside onCreate in Activity, which is recreated on theme change. |
I've tried it as such: class MainApp : Application() {
override fun onCreate() {
super.onCreate()
startKoin {
androidContext(this@MainApp)
modules(
appModule(),
androidModule()
)
logger(PrintLogger())
}
}
} But I get error java.lang.IllegalStateException: KoinApplication has not been started |
Interesting. What are you doing to get this exception? I remember that I encountered this error on first inject call in my pet project when I forgot to register my application class in Manifest file. |
Yes, that's exactly the issue. I had to register application class in manifest file and everything works now. And I've checked and after chaning theme the app doesn't crash. Thank You! |
Omg I have the same problem, I do initKoin() in Common Main:
and my application crashes already when switching themes using the theme switch button in the status bar. |
Describe the bug
When changing from light to dark theme or vice versa, following error is thrown:
KoinAppAlreadyStartedException: A Koin Application has already been started
To Reproduce
Steps to reproduce the behavior:
Expected behavior
App doesn't crash
Koin module and version:
I suppose its koin-compose:3.6.0-wasm-alpha2
I am working on a project that uses compose multiplatform. I've tried using documentation to start koin, but its lacking information regarding compose multiplatform.
Snippet or Sample project to help reproduce
The text was updated successfully, but these errors were encountered: