I know that this question have been asked before but i tried all the answers given and i still got nothing.I'm trying to define a var binding:ActivityMainBinding and i got an error

Unresolved reference:ActivityMainBinding

Here is a part of my mainActivity

import com.kolydas.aboutme.databinding.ActivityMainBinding //error

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding //error

Here is my App build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'    
apply plugin: 'kotlin-kapt'    
apply plugin: 'kotlin-android-extensions'   

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.kolydas.aboutme"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        enabled = true  //enable data binding

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    kapt "com.android.databinding:compiler:3.4.0"

And of course in my xml file i have the layout /layout tags in the beginning and in the end.

1 Answers

Viktor On
kapt "com.android.databinding:compiler:3.4.0"

change to

kapt 'androidx.databinding:databinding-compiler-common:3.4.0'