Android SDK Platform Java SDK Dependency Version Requirement Table

399 Views Asked by At

Is there any official documentation on developer.android.com that states which version of the Java SDK each Android SDK platform depends on?

I currently have 1.7.0_55 for API 23, however newer versions are available, the latest being 7u80 (which I assume is 1.7.0_80).

Can I simply use the latest version of JDK 1.7, or do I need a specific version?

The next time an update is available for API 23, should I also be updating JDK 1.7 accordingly (either to the latest, or whatever is specified, wherever that may be)?


UPDATE

The below table specifies requirements for building the actual OS source, and though I'd like to think that it applies when targeting the corresponding SDK Platforms, I'm not positive.

https://source.android.com/source/requirements

JDK

See Installing the JDK for the prebuilt path and installation instructions for older versions.

  • Android 7.0 (Nougat) - Android 8.0 (O release): Ubuntu - OpenJDK 8, Mac OS - jdk 8u45 or newer
  • Android 5.x (Lollipop) - Android 6.0 (Marshmallow): Ubuntu - OpenJDK 7, Mac OS - jdk-7u71-macosx-x64.dmg
  • Android 2.3.x (Gingerbread) - Android 4.4.x (KitKat): Ubuntu - Java JDK 6, Mac OS - Java JDK 6
  • Android 1.5 (Cupcake) - Android 2.2.x (Froyo): Ubuntu - Java JDK 5
2

There are 2 best solutions below

2
On

The JDK is specified for building the projects but its not the same specification used by the Compliance_Level of the Project you are building.

The point is that the code doesn't have the features from JDK, but its limited from the compiler features specified by Android.

For example: Having JDK 1.8 doesnt give access for Lambdas. (retrolambda gives and a native solution will be added in Android 3.0)

Until AS 2.3+ the Java 1.7 spec is used.

From AS 3.0 (currently on beta) the Java 1.8 spec is used.

Updating the machine JDK doesnt interfer on your code.

4
On

I can't point to specific page in in documentation, but from practical point I have been programming for android last 4 years and update JDK very occasionally once a year, by not connected with Android reasons. So any version of JDK 7/8 will be ok for any api version.