skip to Main Content

I am currently using Kotlin version 232-1.9.0.

In the MainActivity.kt file, I am trying to import the following

import kotlinx.android.synthetic.main.activity_main.*

import kotlinx.android.synthetic.main.content_main.*
Unresolved reference: Android

I am getting the error: Unresolved reference: Android

2

Answers


  1. based on:

    https://blog.jetbrains.com/kotlin/2020/11/kotlin-1-4-20-released/

    https://youtrack.jetbrains.com/issue/KTIJ-14160/AS-kotlinx.android.synthetic.main-is-unresolved-in-a-project-with-buildSrc

    the error you’re encountering is mostly due to the deprecation and removal of Kotlin Android Extensions. As of Kotlin 1.4.20, the Kotlin Android Extensions plugin is deprecated, and its functionality has been replaced by View Binding and Data Binding.

    Login or Signup to reply.
  2. You can only build this with an elder version of Kotlin, which still supported synthetics.
    Else follow the instructions here: Migrate from Kotlin synthetics to Jetpack view binding.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search