I am trying to implement ViewModel in a 100% Kotlin app. Every piece of documentation I can find says I want to use this to get the ViewModel instance:
ViewM
In addition to what Sup suggested, you'll have to correct lifecycler:compiler
to lifecycle:compiler
- the Gradle sync shouldn't even complete successfully with this typo.
Secondly, the standard android annotation processing ("annotationProcessor") doesn't really work with Kotlin. Instead, use Kotlin's kapt.
At the top of your build.gradle file, add the following:
apply plugin: 'kotlin-kapt'
.
And in your dependencies section, replace occurences of annotationProcessor
(like the above one) with kapt
, e.g.
kapt "android.arch.lifecycle:compiler:1.1.1"