Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AndroidX Error: Both old and new data binding packages are available in dependencies

I have already updated gradle.properties file adding:

android.useAndroidX=true
android.enableJetifier=true

But i have this error:

e: [kapt] An exception occurred: android.databinding.tool.util.LoggedErrorException: failure, see logs for details.
AndroidX Error: Both old and new data binding packages are available in dependencies. Make sure you've setup jettifier  for any data binding dependencies and also set android.useAndroidx in your gradle.properties file.
    at android.databinding.tool.util.L.printMessage(L.java:134)
    at android.databinding.tool.util.L.e(L.java:107)
    at android.databinding.tool.Context.discoverAndroidX(Context.kt:62)
like image 418
AJit Avatar asked Jan 16 '19 10:01

AJit


1 Answers

Even if you enable the use of AndroidX

android.useAndroidX=true
android.enableJetifier=true

and databinding

android {
    ...
    ...
    dataBinding {
        enabled = true
    }

}

you will still have problems related to dependencies.

I suggest to you, refactoring and changing automatically all the necessary imports to Android X to avoid this kind of problems.

Select your project, go yo Refactor > Migrate to AndroidX

enter image description here

like image 131
Jorgesys Avatar answered Oct 06 '22 08:10

Jorgesys