RecyclerView#onMeasure() did not set the measured dimension by calling setMeasuredDimension()

I think that this is because we are calling RecyclerView.setLayoutManager() with a LayoutManager that already has a RecyclerView.

public void setLayoutManager(LayoutManager layout) {
    ...
    if (layout != null) {
        if (layout.mRecyclerView != null) {
            throw new IllegalArgumentException("LayoutManager " + layout
                    + " is already attached to a RecyclerView:"
                    + layout.mRecyclerView.exceptionLabel());
        }
        mLayout.setRecyclerView(this);
        if (mIsAttached) {
            mLayout.dispatchAttachedToWindow(this);
        }
    }
    ...
}

But for a reason that I don't understand, the exception that is printed in Logcat is

UncaughtException: java.lang.IllegalStateException: View with id 2131231433: android.support.v7.widget.RecyclerView#onMeasure() did not set the measured dimension by calling setMeasuredDimension()`

Maybe something catches this exception and throws this one instead (without cause)?