Disclaimer:
The fix below is intended to solve a specific problem with some
dependencies conflict, mostly databinding issues can cause this error but are
only a consequence of wrong XML or code and the
solution below will not work in this case. Double check your XML/code correctness before trying the below solution.
This is a known problem with some databinding versions (which is embedded in Android Studio) and other dependencies like Room which import different versions of org.antlr:antlr4 library.
UPDATE: 12/06/2020 (dd/MM/yyyy)
If you use Room, updating to Room 2.3.0-alpha01 or above should remove the error because they have fixed the problem here: https://issuetracker.google.com/issues/150106190
Put this configuration in the app build.gradle
//groovy
configurations.all {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.7.1"
resolutionStrategy.force "org.antlr:antlr4-tool:4.7.1"
}
//kotlin DSL
configurations.all {
resolutionStrategy {
force("org.antlr:antlr4-runtime:4.7.1")
force("org.antlr:antlr4-tool:4.7.1")
}
}
If you still have problems, you can try using the
4.5.3version above
instead of4.7.1to downgrade the library
Reference