androidandroid-sourcesets

What is the location of android.databinding.Observable?


Android Studio 3.0.1 is complaining that it can't find this class. Even though it builds, it just shows an awful red underline. That's my first question, but also curious where IS this elusive class?

Looking in the expanded libraries it doesn't show it: /Library/Android/sdk/extras/android/m2repository/com/android/databinding/library/1.3.1/library-1.3.1-sources.jar

And looking online for the source I'm also coming up short: https://android.googlesource.com/platform/frameworks/data-binding/+/c9a5d6f140f732ca0ff279a4b1ee315072e1c422/library/src/main/java/android/databinding


Solution

  • Android Studio 3.0.1 is complaining that it can't find this class. Even though it builds, it just shows an awful red underline

    That's odd. I just pulled up a project in AS 3.0.1 that uses the data binding framework, and I can import android.databinding.Observable just fine.

    Then again, Android Studio is... quirky.

    where IS this elusive class?

    In my environment, it is in com.android.databinding:baseLibrary:3.0.1:

    Android Studio 3.0.1, Showing Data Binding Dependency

    That, and com.android.databinding:adapters:1.3.1 and com.android.databinding:library:1.3.1, are added to your dependencies by the Android Gradle Plugin if you enable data binding.