Today I’m writing a bit of code and I need to combine a few RxJava streams into a single stream, using combineLatest(). And it’s not working, not even compiling, and I don’t know why. All I have are some multi-line error messages full of imcomprehensible gibberish of the type you get when the compiler gets lost in a maze of generics. The only comprehensible error message said “Interface Function4 does not have constructors”. Of course it doesn’t, it’s a Java interface.

After an embarrassingly long period of experimenting, Googleing, more experimenting, more Googleing, and even reading documentation, I eventually head to the top of the file and add the following line:

import io.reactivex.functions.Function4

And like magic, it all suddenly works! Head, meet desk!

I don’t know why Android Studio hadn’t imported Function4, or which Function4 it was trying to use.

Hopefully this saves someone else from frustration.