Currently I am using java 8
with latest android studio 2.1
Here is my build.gradle
file
android {
compileSdkVersion 22
buildToolsVersion "24rc3"
defaultConfig {
applicationId "com.name"
minSdkVersion 10
targetSdkVersion 19
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
.......
}
I am getting the below compile time error that I have no clue
Error:com.android.jack.frontend.FrontendCompilationException: Failed to compile at com.android.jack.Jack.buildSession(Jack.java:892) at com.android.jack.Jack.run(Jack.java:472) at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102) ... 8 more Warning:Exception while processing task java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile :oTT:compileDebugJavaWithJack FAILED Error:Execution failed for task ':oTT:compileDebugJavaWithJack'.
java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile Information:BUILD FAILED
Please feel to ask if you need some details.
Java 8 language features are now supported by the Android build system in the javac/dx compilation path. Android Studio's Gradle plugin now desugars Java 8 class files to Java 7-compatible class files, so you can use lambdas, method references and other features of Java 8.
Up to Android Studio 3.5 beta 2 one could use JDK11 for compiling project by configuring it in Project Structure -> SDK Location -> JDK Location. This way Android Studio is run under bundled JDK8 but Gradle is using selected JDK11. Starting from Android Studio 3.5 beta 3 this setup is no longer supported.
Android Studio supports all the same programming languages of IntelliJ (and CLion) e.g. Java, C++, and more with extensions, such as Go; and Android Studio 3.0 or later supports Kotlin and "all Java 7 language features and a subset of Java 8 language features that vary by platform version." External projects backport ...
If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin.
I had this error too, and what I found was that the error itself was masking another compilation issue. Look at your Console Messages carefully and see if there is something else not compiling. Once I solved the underlying issue with my own code, this error magically disappeared. Hope this helps.
Try to use next values:
compileSdkVersion = "android-N" buildToolsVersion = "24.0.0 rc3"
you can try
compileSdkVersion 23
buildToolsVersion '24.0.0-rc3'
note the dash before rc3. This is according to http://developer.android.com/preview/setup-sdk.html under the section "Update an existing project"
I am using 23 just for the lambda.
the following link shows the Supported Java 8 Language Features and APIs https://developer.android.com/preview/j8-jack.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With