Quick Fix: Invoke-customs are only supported starting with Android O (--min-api 26)

Quick Fix: Invoke-customs are only supported starting with Android O (--min-api 26)

·

1 min read

This error gave me a hard time and finding a fix for it took quite a while so posting it will definitely help lot of android developers out there.

Here's what it looks like in an IDE. I've highlighted the error's stacktrace so you can spot it easily.

Screenshot from 2020-09-07 09-44-00.png

To fix this error, just add this code snippet to your app-level build.gradle file.

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Again, I've highlighted the code snippet so you can spot it easily.

Screenshot from 2020-09-07 10-06-23.png

Happy coding!