After updating android studio 3.1.2 my existing project gives error at
dataBinding.enabled = true
error is as follows-
Failed to resolve: com.android.databinding:library:3.1.2
Failed to resolve: com.android.databinding:adapters:3.1.2
my gradle dependency are as follows-
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:recyclerview-v7:25.1.0'
implementation 'com.android.support:preference-v7:25.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
implementation 'com.firebase:firebase-jobdispatcher:0.5.0'
// Instrumentation dependencies use androidTestCompile
// (as opposed to testCompile for local unit tests run in the JVM)
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:25.1.0'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test:rules:0.5'
}
I also tried
android.databinding.enableV2=true
but its also not working
When I tried to update build tool version to 4.4 then I found this error. I f I do not update the build tool version then its working fine.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With