Почему DataBinding подсвечивает красным?

Почему DataBinding подсвечивает красным? введите сюда описание изображения

А в примере на ютубе такого нету? https://www.youtube.com/watch?v=30q1fcIIhZg&t=213s

Мой gradle

plugins {
    id 'com.android.application'
}

android {


    buildFeatures {
        viewBinding true
    }
    compileSdk 31

    defaultConfig {
        applicationId "com.buratinoapps.cryptocurrency.fb.download.video"
        minSdk 21
        targetSdk 31
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.7.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.3.1'
    implementation 'com.squareup.okhttp3:okhttp:4.9.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'org.apache.commons:commons-lang3:3.5'
    implementation 'commons-io:commons-io:2.4'
    implementation 'org.jsoup:jsoup:1.14.3'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.amitshekhar.android:android-networking:1.0.2'
}

Ответы (1 шт):

Автор решения: Антоша

Имя Binding должно совпадать с разметкой активити, но Camel case

То есть, если у Вас активити имеет имя my_best_activity.xml, то байдинг должен иметь имя MyBestActivityBinding

Также иногда может помочь пересобрка проекта Build->Clean Project, а затем Build->Rebuild Project

→ Ссылка