-
-
Notifications
You must be signed in to change notification settings - Fork 719
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
Can't getByClass ViewModel from ViewModelFactory with empty parameters #236
Comments
Put logs with KOIN tag. But I think that in single { PreferenceManager.getDefaultSharedPreferences(get()) as SharedPreferences } isn't passed context. Did you have a global access to main application class? try pass it instead get(). |
The problem is that I can't reproduce this crash. I can only see it via Firebase Crashlytisc.
It happens only to 0.01% of my users, but still. I'm not sure what you meant by
something like that ? single { PreferenceManager.getDefaultSharedPreferences(androidApplication()) as SharedPreferences } |
Looking at https://github.com/InsertKoinIO/koin/blob/88a917ebd45b6ddfeeb96904573e8baa6d6c9a11/koin-projects/koin-android-viewmodel/src/main/java/org/koin/android/viewmodel/ViewModelFactory.kt |
Yep, in this case, it can come from unallocated parameters from ViewModel factory. But why :/ |
Right, so it can randomly become null if GC decides so? |
Why this line |
As far as I know, Android Apps can go to background anytime system decide so.
So I can use viewModel instance in my XML layout. But I'm sure that it doesn't matter, because in other fragments (PhotosFragment.kt, LiquidFragment.kt) which also crashes, I'm not using DataBinding. |
INteresting question. My initial thought is that we need to transmit parameters to the ViewModelFactory, to help Koin create the right instance behind that. Does your VM has been created? Perhaps rethink this VM interaction/creation should help it. |
Sorry but, I don't know how to answer your question |
The same issue. Can't getByClass ViewModel from ViewModelFactory with empty parameters on app start. |
Don't worry, I'm on it. 👍 |
Same issue here:
It happens in 1 of 10 cases. |
Can you try with |
Testing 1.0.1-alpha-1 |
Just starting testing 1.0.1-alpha-1 in our team. We will let you know, whether the problem is solved or not. Thanks |
It looks like everything works now. Thank you. |
nice :) |
Fixed in |
Describe the bug
I'm getting
Fatal Exception: java.lang.IllegalStateException
from
org.koin.androidx.viewmodel.ViewModelFactory.create (ViewModelFactory.kt:44)
that says
Can't getByClass ViewModel from ViewModelFactory with empty parameters
when i do
Koin project used and used version (please complete the following information):
Additional moduleDefinition
The text was updated successfully, but these errors were encountered: