I am getting a build error message that I don’t un...
# announcements
e
I am getting a build error message that I don’t understand:
Copy code
e: /Users/espertus/src/firefox-voice/android-app/app/src/main/java/mozilla/voice/assistant/intents/communication/ui/contact/ContactCursorAdapter.kt: (49, 30): Overload resolution ambiguity: 
public final val itemView: View defined in mozilla.voice.assistant.intents.communication.ui.contact.MyAdapter.MyViewHolder
public final val itemView: View defined in mozilla.voice.assistant.intents.communication.ui.contact.MyAdapter.MyViewHolder
Lines 2 and 3 of the error are identical, so I don’t see the ambiguity. Here is the relevant code:
Copy code
class MyAdapter(
    private val cursor: Cursor
) : RecyclerView.Adapter<MyAdapter.MyViewHolder>() {
    class MyViewHolder(val itemView: View) : RecyclerView.ViewHolder(itemView) {
        private val ivContactPhoto: ImageView

        init {
            ivContactPhoto = itemView.findViewById(R.id.ivContactPhoto) as ImageView
        }
    }
d
What happens if you remove val from itemView in the constructor or rename it to something else?
e
Renaming it fixed it. Thank you, @Dustin Lam!
d
Or rather, I think it's because ViewHolder already has an itemView property
You can also just remove val, and use the itemView property from the base class, which should essentially be the same thing
1
d
#android