Kotlin not able to get type interference required Array! found Array

I am trying to use a uriArray for parsing path of images but stuck at one point in kotlin, it’s giving me issue of required Array! found Array

 val uriArray = arrayOfNulls<Uri>(imageList.size)
                    for (i in imageList.indices) {
                        val imgaesModel = imageList.get(i)
                        uriArray[i] = Uri.parse("file:" + imgaesModel.getPath())
                    }
                    mFilePathCallback!!.onReceiveValue(uriArray)
           // Above line is giving error 

Please give me some suggestions as I am new to Kotlin, little will be appreciated.

Answer

An alternative to tasoluko’s answer is

val uriArray = Array<Uri>(imageList.size) { i ->
    val imagesModel = imageList[i] // get method can be written as indexing
    Uri.parse("file:" + imagesModel.path) // instead of getPath()
}