I am new to android development. And I have installed eclipse, java 11 and android sdk tools in my computer. But when I try to build a project it says that to upgrad
As official doc says:
Android Studio 3.0 and later supports all Java 7 language features and a subset of Java 8 language features that vary by platform version
so JDK 7 is fully supported, and if you want to use some JDK 8 features, you should Make the appropriate settings.
Here is the ref link for using Java 8
and android studio doesn't support the java version higher than 8.
May be this 2 articles give more understanding on the situation:
Jake Wharton - Android's Java 9, 10, 11, and 12 Support
Jake Wharton - Android's Java 8 Support
Some features of java 9-12 also supported in Android if you set appropriate compileOptions, for example
compileOptions {
targetCompatibility JavaVersion.VERSION_12
sourceCompatibility JavaVersion.VERSION_12
}
P.S. for java 12 you need to set "likely latest" version of Gradle plugin.
As of 2020 October, A lot of the missing APIs and newer versions of Java are now supported through Open JDK. Some helpful links I find: Support for newer Java language APIs (Official Youtube Video) and Java 8+ APIs available through desugaring. I hope this can help someone struggling with Java versions compatibility
You have the direction of fit backwards. Android supports certain versions of Java, not the other way around.
That being said, Oracle Java and Android Java aren't really the same thing - they don't even use the same virtual machine, as a matter of fact. They're being developed completely separately.
As others have indicated, recent versions of Android supports up to Java 7 and a subset of Java 8 features. Older versions of Android may support less than that.