You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just check out and run the app from the repository
See the crash
Caused by: org.koin.core.error.NoBeanDefFoundException: No definition found for class:'com.joernahrens.android.kointest.ui.main.MainFragment'. Check your definitions!
Koin doesn't find the fragment instance in the scope.
Expected behavior
It should be able to inject the ScopeFragment instance.
Koin project used and used version (please complete the following information):
Hi. The ability to access Fragment as source of your FragmentScope was removed due to a memory leak: #953 .
As your FragmentScope lives longer than your Fragment (configuration changes etc.) it can't be used the way it is in your example.
If you need a scope where you can access the fragment as source i think you should create a custom scope and handle it's lifecycle on your own.
Hi @Pfoerd, I agree with the memory leak problem and stumpled upon that issue, so yeah, it explain why it doesn't work. But my understanding of the scope is different, and I think my expectation matches the documentation.
As your FragmentScope lives longer than your Fragment (configuration changes etc.)
My understanding of activity and fragment scopes was, that they don't survive a configuration change, instead all scoped stuff is recreated. Is this a misunderstanding?
Describe the bug
I have fragment-scoped modules like this:
With version 2.2.1, the fragment can't be injected anymore.
To Reproduce
I created a small repo to show this bug: https://github.com/joernahrens/kointest
Steps to reproduce the behavior:
Caused by: org.koin.core.error.NoBeanDefFoundException: No definition found for class:'com.joernahrens.android.kointest.ui.main.MainFragment'. Check your definitions!
Koin doesn't find the fragment instance in the scope.
Expected behavior
It should be able to inject the ScopeFragment instance.
Koin project used and used version (please complete the following information):
This worked in version 2.2.0.
The text was updated successfully, but these errors were encountered: