Siddhivinayak
Siddhivinayak

Reputation: 1101

Could not find com.android.databinding:library:3.1.1

I upgraded to Android Studio 3.1.1 and trying to clone a project from GitHub but unable to run it due to the following error

Could not find com.android.databinding:library:3.1.1.

I have tried this & this but unable to resolve the issue. The latter suggests to update to the 3.2 canary 10 version but is there no way to resolve this in 3.1.1?

EDIT after Android Team suggestion

buildscript {
    repositories {
        jcenter()
      google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Screenshot: enter image description here

Upvotes: 4

Views: 3999

Answers (2)

De Xian
De Xian

Reputation: 11

just add google() to your project level gradle file, and it will fix the issue

buildscript {
repositories {
    google()        //<-----This line
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.1'
    classpath 'com.google.gms:google-services:4.0.1'

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

allprojects {
    repositories {
        google()     //<-----This line
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

}

Upvotes: 1

user4571931
user4571931

Reputation:

you can add your project level gradle file ,please verify you are not missing jcenter() in your 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
}

Upvotes: 4

Related Questions