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

AndroidAndroid StudioAndroid Gradle-Plugin

Android Problem Overview


before i'm use build version gradle 26 but after change buildtoolsversion to 27 like as this image

I am using android studio 4.2.2 recently i update all my dependency and

      sourceCompatibility JavaVersion.VERSION_1_10
      targetCompatibility JavaVersion.VERSION_1_10

to

compileOptions {
           sourceCompatibility kotlin_version
           targetCompatibility kotlin_version
         }

after update i am getting this error please help

error : error build gradle screenshot

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

If compileOptions doesn't work, try this

Disable 'Instant Run'.

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

Solution 3 - Android

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
  
}

Solution 4 - Android

If you have Java 7 so include the below following snippet within your app-level build.gradle :

compileOptions {

    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7

}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRona IdeaView Question on Stackoverflow
Solution 1 - AndroidObakeng MolebatsiView Answer on Stackoverflow
Solution 2 - AndroidRoshni KyadaView Answer on Stackoverflow
Solution 3 - AndroidNata SturzaView Answer on Stackoverflow
Solution 4 - AndroidChirag PatelView Answer on Stackoverflow