The android toolchain does some extra steps before the code is run on your device:
.java -> .class -> .class (desugared) -> .dex
This is described here: https://developer.android.com/studio/write/java8-support
The desugaring step is responsible for turning your modern bytecode into something that works on older VMs.
How backwards compatible the desugaring makes your code depends on the minSdkVersion. If your project makes a combination of sourceCompatibility/targetCompatibility and minSdkVersion that isn’t possible, the compiler will tell you.
This also goes for byte code from 3rd party libraries. Errors look like this:
Error: Static interface methods are only supported starting with Android N (--min-api 24): okhttp3.Request
(this specific problem came from using 1.7 source compatibility with okhttp3 4.0.1 and went away by using target 1.8)