How does Android's Java version relate to a Java SE version?
Android's version doesn't directly relate to Java SE, although it uses a subset of Apache Harmony's SE 6 libraries and tools. It will be up to the Android team to decide if & when to support/require the SE 7 version of Harmony.
Edit It looks like as of KitKat Android supports Java SE 7 language features. See the comments below.
Which Java version is the fastest on and is supported by Android?
I heard that Java is becoming faster on newer versions of Android that it's almost as fast as C++,
The Java platform has had performance around that of C++ for a couple decades. Sometimes faster, due to the dynamic runtime optimizations made by HotSpot or OpenJ9.
But Android does not run the Java platform.
When writing Android code in either the Kotlin language or the Java language, that code is compiled down to Dalvik bytecode. At runtime, that byte code is further interpreted/compiled by the Android Runtime in modern Android, or by the Dalvik Runtime in earlier Android.
which Java version is the fastest on Android and is supported for Android development?
Your choice of JDK and Java version will not affect the performance of your Android app. As explained above, the JDK is not involved with the runtime execution of your Android app.
Would the upgrade be worth it, and is it different from Java 8/11 in how it builds/syntax/features?
You can make use of some of the new Java language features found in later versions of Java. See links below.
I wouldn't want to simply install different Java versions and change Android Studio's settings.
You can certainly install multiple JDKs on your machine. For installing and managing multiple JDKs, I suggest using SDKMAN.
Within Android Studio, in your project's settings, you specify which of the installed JDKs to utilize. See Set the JDK version section in the manual.
Note however that the documentation recommends using the JDK that comes bundled with Android Studio.
For more info, use the links provided by CommonsWare:
- Android's Java 9, 10, 11, and 12 Support (2018-11)
- API desugaring
Which Java SE versions work with android studio 3.1?
The maximum possible version for Android Studio 3.1 is Java 8. Also, some of the features of Java 8 are unavailable for lower API versions. For example, my minimum API version is 16 and if I try to use stream
, I get errors because these features are available only for API 24 and higher. You can use lambda expressions, method references however etc.
To know more, visit this Link
Why is android still using Java 8?
Java 9 removed some methods used in the Android API
You can see the full list here
https://www.oracle.com/technetwork/java/javase/9-removed-features-3745614.html
To verify this, you can install Java 9 on your environment, use it and then run the tests using the command line; the test will fail indicating there is a problem with missing methods.
I can't remember which methods in specific, and please notice; that removed is not deprecated, it is deleted from the code.
My best deduction is:
- Kotlin is now a thing
- Oracle is suing Google
Refactoring the Android API to match the new Java versions gets low priority in that scenario
Which Java JDK should I install for the use of Android Studio
The official doc says:
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. To use the bundled JDK, do the following:
- Open your project in Android Studio and select File > Project Structure in the menu bar.
- In the SDK Location page and under JDK location, check the Use embedded JDK checkbox.
- Click OK.
So there is no need to install a standalone JDK if you are not planning to do Java Devs other than Android App.
Which Android versions run which Java versions?
and so, apparently, Android 4.0 does not support Java 7.
By your definition, Android does not support any version of Java. The java
and javax
classes in the Android SDK do not exactly match any version of Java, whether a numerical version (e.g., 6, 7, 8) or whatever you want to consider Java SE/EE/ME to be.
Is there an overview which clearly shows which Android versions come with which Java version
In terms of language features (e.g., lambda expressions), quoting the documentation:
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
Here, "Android Studio" is really referring to the build tools that compile your source code and create the Dalvik bytecode. Current tools can support all Java 7 and a few Java 8 features on all versions of Android. Additional Java 8 features are only available on API Level 24+, usually because they rely upon certain classes that were only added to the Android SDK at that point.
But your concern seems to be with classes and methods, in which case there is no simple mapping of any Java version to any Android version.
Moreover, you are using reflection to hack into framework classes, which means your results will not only vary by Android version but by device model, as device manufacturers can and do change the implementation of framework classes.
Related Topics
How to Solve the "Double-Checked Locking Is Broken" Declaration in Java
Why Do I Need Transaction in Hibernate for Read-Only Operations
How to Make an Array of Arrays in Java
Turning Off Hibernate Logging Console Output
Sort Arrays of Primitive Types in Descending Order
Singleton Class with Several Different Classloaders
Can Not Find the Tag Library Descriptor for "Http://Java.Sun.Com/Jsp/Jstl/Core"
Using File.Listfiles with Filenameextensionfilter
Custom JSON Deserialization with Jackson
Background Timer Task in Jsp/Servlet Web Application
How to Create Your Own Library for Android Development to Be Used in Every Program You Write
Java Doesn't Work with Regex \S, Says: Invalid Escape Sequence