I was having the problem while assigning text to textview with same problem description.
All I did was putting double exclamation mark after the name of my textview.
For example:
var name:TextView?=null
name = findViewById(R.id.id_name)
name!!.text = "Your text"