I just downloaded JDK 1.8.0_51 from my previous JDK 1.8.0_33 because i was having issues. There being some workaround to use Jdk 8 with Android, I was just wondering has Google already added a full support to the JDK in Android studio ? or should I just use JDK 1.7? advice will be highly appreciated.
Set the JDK version A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects.
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.
Since Android apps are written in Java, you will need the Oracle Java compiler and libraries on your system. These are collectively called the Java Development Kit or "JDK" for short.
Class libraryJava 8 source code that works in latest version of Android, can be made to work in older versions of Android.
you can now use java8 with android
add this lines in you build.gradle file
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
refer this doc http://developer.android.com/intl/es/preview/j8-jack.html
Make sure to enable Jack as well with:
android { //... defaultConfig { //... // Required to use Java 8. jackOptions { enabled true } }
Additionally, you will need to be using version 24 or greater of the Android SDK Build Tools:
android { //... buildToolsVersion "25.0.2" }
You should just use JDK 1.7. There are some features in JDK 8 that are not yet supported.
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