This compiles with no errors:

```
Function<T, List<R>> f = T::getRs;
Function<List<R>, Stream<R>> g = List::stream;
Function<T, Stream<R>> h = f.andThen(g);
List<T> ts = ...;
ts.stream().flatMap(h);

```

But this produces errors:

```
List<T> ts = ...;
ts.stream().flatMap(T::getRs.andThen(List::stream));

```

The errors are:

```
error: method reference not expected here
        .flatMap(T::getRs.andThen((List::stream)))
                 ^
error: invalid method reference
        .flatMap(T::getRs.andThen((List::stream)))
                                   ^
  non-static method stream() cannot be referenced from a static context
  where E is a type-variable:
    E extends Object declared in interface Collection

```

I would have thought that the two approaches would be equivalent. Am I missing some syntax? Some grouping somewhere perhaps? I would prefer to take the latter "one-line" approach if possible.
['https://Stackoverflow.com/questions/48859005', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/31379/']
I found workaround for this...
from <https://issuetracker.google.com/issues/63814741>

adding

```
android.enableExperimentalFeatureDatabinding = true
android.databinding.enableV2=true

```

in `gradle.properties` files kinda solve the issue... but I doubt that this is a solution... but for now... this is how the problem is solved
I also encountered this issue recently. Adding kapt plugin to app level build.gradle file solved my issue. The problem is that you already have that plugin in your gradle file. Maybe issue is resolved after some time but I want to leave this answer because this question comes up first in Google search.

`apply plugin: 'kotlin-kapt'`