Android - java.lang.IndexOutOfBoundsException: Invalid item position 0(0). Item count:0

I meet the same problem, and I find a better way to solve it.

call setAutoMeasureEnabled(false); in the constructor of your custom LayoutManager.

After API level 27 setAutoMeasureEnabled() is deprecated. So just override this method in your Custom LinearLayoutManager

@Override
public boolean isAutoMeasureEnabled() {
    return false;
}

Finally resolved :)

Replacing

compile 'com.android.support:recyclerview-v7:23.2.1'

to

compile 'com.android.support:recyclerview-v7:22.+'

worked.

Not Sure, this is perfect solution or not, but it worked for me.