Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8

13,688

Solution 1

Check you version of com.android.tools.build:gradle.

I had the same error. My solution:

  • set com.android.tools.build:gradle:3.0.0-alpha6
  • update kotlin to 1.1.3-2
  • add to repositories google()

I'm using AS 3.0 Canary 6.

Solution 2

You should do the following:

  • Update your Android Studio to version 3.0.1.

  • Upgrade your gradle to 'com.android.tools.build:gradle:3.0.1'

  • Make sure you buildToolsVersion is at least 26.0.2.

After that you can remove Jack options and use supported Java 8 features.

Share:
13,688

Related videos on Youtube

Amarjit Dhillon
Author by

Amarjit Dhillon

Check out my personal blog at https://medium.com/@smartsplash Twitter 🐦 https://twitter.com/smartsplash Linkedin 🔗 https://www.linkedin.com/in/amaardhillon/

Updated on June 04, 2022

Comments

  • Amarjit Dhillon
    Amarjit Dhillon about 2 years

    As per mentioned in developer.android website

    "The Jack toolchain is deprecated, as per this announcement. If your project depends on Jack, you should migrate to using Java 8 support built into Android Studio’s default toolchain."

    enter image description here

    I need to use lambda expressions so I have disabled the jack options, but when I compile my code, I get the following error

    Error:Jack is required to support Java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8. 
    

    Below is the screenshot of my build.gradle file

    enter image description here

  • desgraci
    desgraci over 6 years
    what if we don't use the beta version of AS, no workaround on this?