Skip to content Skip to sidebar Skip to footer

Variable Is Declared As Var But Compiler Is Saying It Val

Compiler is giving me the error Error:(97, 17) Val cannot be reassigned but the variable is declared as var. Edit: You can see comments in my code. When i assign rcv = recyclerVi

Solution 1:

Seems like a bug in the static code analysis or it may be caused by incremental compiling. Try to rebuild/clean the project.

Or try this:

privatefungetMainView(): View {
    return with(context) {
        frameLayout {
           rcv = null
        }
    }
}

If the compilation works now, add back your original code and compile again.

Post a Comment for "Variable Is Declared As Var But Compiler Is Saying It Val"