Failed to resolve: com.android.databinding:library:3.1.2

check it this below code in your project level gradle file ..

buildscript {

    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'

        // NOTE: Do not place your application dependencies here; they    belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

According to the Android Team answer you had to add

google() too all repositories

and priority is important. so other repositories must be added after google()


Downgrade to 3.1.0 in project level build.gradle file, then rebuild the project.

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

I hope this helps