0

After migrating to androidx

I'm getting issue while compiling

error: cannot find symbol androidx.databinding.DataBindingComponent

symbol: class DataBindingComponent location: package androidx.databinding

Gradle version im using is 5.4.1

Note: Other components in androidx.databinding packages working fine. Like DataBindingUtil

Only DataBindingComponent is not working

public class FragmentDataBindingComponent implements androidx.databinding.DataBindingComponent {
public FragmentBindingAdapters getFragmentBindingAdapters() {
    return adapter;
}
}
VijayDroid
  • 126
  • 1
  • 7
  • Does this answer your question? [Cannot find symbol DataBindingComponent on Android Studio 3.2 Canary 16 Kotlin project](https://stackoverflow.com/questions/50594507/cannot-find-symbol-databindingcomponent-on-android-studio-3-2-canary-16-kotlin-p) – Nongthonbam Tonthoi Apr 21 '20 at 11:22
  • add library version, like androidx.databinding:databinding-compiler:x.x.x – Ashish Sharma Apr 21 '20 at 11:22
  • @NongthonbamTonthoi tried annotationProcessor "androidx.databinding:databinding-compiler:4.1.0-alpha06" but still same issue – VijayDroid Apr 21 '20 at 11:32
  • I ran into this recently where I had enabled view binding but I had a layout with a `` root element, and that combination does not work. – CommonsWare Apr 21 '20 at 12:10

1 Answers1

0

This could be a issue because of incompatible libraries, and usually happens when a batch update to the libraries is made. One solution is to make small increment changes to the libraries and trying to build the project after every increment. The goal is to isolate the incompatible dependencies. This assumes that your layout files are wrapped inside markup fields and the bug actually originates from the upgrade and not from source code.

Karan Dhillon
  • 1,186
  • 1
  • 6
  • 14