On 7th May, 2019 androidx.lifecycle:*:2.2.0-alpha01
was released announcing:
This release adds new features that adds support for Kotlin coro
The accepted answers is working, but I'm misused for the first time, so I'm trying to make it clear, the current version of lifecycle
is "2.1.0"
and lifecycleScope
, and ViewModelScope
is not available in this version, to get them use
For ViewModelScope, use androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0-beta01
or higher.
For LifecycleScope, use androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-alpha01
or higher.
at this time 2.3.0-rc01
is available.