I encountered a weird thing today. In Android Studio 3.1.1,
import android.arch.lifecycle.ViewModelProvider is totally while
import android.arch.lifecycle.ViewModelProviders is not fine. Because there is no
lifecycle package. The solution is to add the packages by yourself. It doesn’t even get mentioned in the official doc and most of the tutorials online. And after working with some already setup project. It finally beats me.
Just add these 2 lines to the proper
The version number maybe different in the future but it’s fine, because Android Studio gonna tell the version number for the latest version.
Hope it helps.