I use Android Studio and recently got the error:
Error:Execution failed for task \':app:compileDebugJavaWithJavac\'. compileSdkVersion \'android-24\' re
I have a same problem for days. I found a solution which worked from me on Windows. (I also set environment variables, but don't know whether it's needed.)
Add these lines to build.gradle file:
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
Source: https://code.google.com/p/android/issues/detail?id=203850
In Android Studio open:
File
> Project Structure
> see if JDK location points to your JDK 1.8 directory.
Note: you can use compileSdkVersion 24