2

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

Erik B
  • 2,810
  • 1
  • 34
  • 38
  • 1
    https://android.googlesource.com/platform/frameworks/data-binding/+/master/baseLibrary/src/main/java/android/databinding/Observable.java derived stuff is here https://android.googlesource.com/platform/frameworks/data-binding/+/master/extensions/library/src/main/java/android/databinding – Tim Nov 27 '17 at 22:17
  • @TimCastelijns nice google-foo! Not sure why it didn't come up for me – Erik B Nov 27 '17 at 22:30
  • 1
    I didn't google it. Just searched the repo by hand, in places where I expected it to show up – Tim Nov 27 '17 at 22:32

2 Answers2

2

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 1
    Thanks! I updated the gradle plugin version, synced, and then reverted and synced and now I see the baseLibrary jar. – Erik B Nov 27 '17 at 22:26
1

The link you provided refers to commit SHA c9a5d6f which is from some time ago:

git clone https://android.googlesource.com/platform/frameworks/data-binding
cd data-binding
git show c9a5d6f

commit c9a5d6f140f732ca0ff279a4b1ee315072e1c422
Author: George Mount <mount@google.com>
Date:   Fri Jul 10 15:43:11 2015 -0700

Looking at the "current" (as of Nov 27, 2017), it is present:

ls baseLibrary/src/main/java/android/databinding/Observable.java
Travis
  • 1,926
  • 1
  • 19
  • 26