Invoke-customs are only supported starting with Android O ( — min-api 26) — Solution

Error:

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

Reason:

Possibly, one of the reason for this Invoke-customs support error is using the Lambda functions/Expressions instead of inline callbacks as the Lambda functions/Expressions are introduced in Java 8 and application must be compatible with Java 8 to use them.

Solution -1 (Tested and Working):

Adding the below snippet in build.gradle(App level)

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

Solution 2 (Not Tested):

Disable ‘Instant Run’.

Android App Developer and Tech Enthusiast