-
-
Notifications
You must be signed in to change notification settings - Fork 720
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
Support AndroidX ViewModel #122
Comments
Hello, AndroidX is in |
Same issue here. I have to remove koin viewmodel injection until there is support or a workaround for this. |
We need to create a new koin android project to let you use the androidx library and keep compat with old support lib. We are on it. Stay tuned 👍 |
I have done the change for our use. It really not that big, just some import and one dependency to change in the build.gradle. For those who doesn't want to wait, just copy, paste the 3 classes inside android-architecture folder and update imports. |
I've created a fork with an androidx version, see https://github.com/mattmook/koin, however I have not currently raised a PR as it depends on the yet unreleased Android-P as well as alpha versions of androidx. |
@mattmook have you made it from the |
@arnaudgiuliani no, but I have just reapplied the changes... https://github.com/mattmook/koin/tree/1.0.0 Assuming you are happy with the changes I can create a PR, as stated before I haven't yet because of the pre-release nature of androidx and android-p |
Thanks @mattmook, I've just created the |
A first version is available under |
I see the other modules on bintray, but not |
Argh ... yes :/ I need too link it to jcenter. Sorry. |
implementation "org.koin:koin-androidx:1.0.0-alpha-11" |
@arnaudgiuliani thanks that works well |
Looking at the updated
|
Sorry, didn't push all the last sources. But, you're right it was a glitch from my part. |
Cool, thanks |
note: package to check is |
I can't download package |
The first package is independent of androidx so is simply Documentation for the setup of the beta is https://beta.insert-koin.io/docs/1.0/documentation/koin-android/index.html#_gradle_setup |
Is your feature request related to a problem? Please describe.
Google is changing the packaging to AndroidX, so, when we use Koin viewModel to do the injection it crashes with:
Type parameter bound for T in inline fun <reified T : ViewModel> Context.viewModel(name: String = ..., noinline definition: Definition<T> /* = (ParameterProvider) -> T */): Unit is not satisfied: inferred type MyViewModel is not a subtype of ViewModel e: ...
Describe the solution you'd like
Allow to use androidx.lifecycle.ViewModel
Describe alternatives you've considered
hum... I don't think there are not a lot of alternatives
Target Koin project
android
The text was updated successfully, but these errors were encountered: