Invoke-customs are only supported starting with android 0 --min-api 26 [closed] Invoke-customs are only supported starting with android 0 --min-api 26 [closed] android android

Invoke-customs are only supported starting with android 0 --min-api 26 [closed]


After hours of struggling, I solved it by including the following within app/build.gradle:

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

https://github.com/mapbox/mapbox-gl-native/issues/11378


If compileOptions doesn't work, try this

Disable 'Instant Run'.

Android Studio -> File -> Settings -> Build, Execution, Deployment -> Instant Run -> Disable checkbox


In my case the error was still there, because my system used upgraded Java.If you are using Java 10, modify the compileOptions:

compileOptions {    sourceCompatibility JavaVersion.VERSION_1_10    targetCompatibility JavaVersion.VERSION_1_10}