Accidental override error while declaring android.graphics.Matrix


#1

Accidental override error after converting Java code to Kotlin


Maybe this is a duplicate topic, but other topics are about error in methods, but here is an error while declaring a variable.


Here is error message:
Accidental override: The following declarations have the same JVM signature (getMatrix()Landroid/graphics/Matrix;):
fun (): Matrix? defined in com.username.someapp.TouchImageView
fun getMatrix(): Matrix! defined in com.username.someapp.TouchImageView

Here is the line causing error:

import android.graphics.Matrix

private var matrix: Matrix? = null


#2

:sweat_smile: Fixed after renaming variable name from matrix to for ex. matrix1
In Java code this name was not causing conflict :face_with_raised_eyebrow: