This is what my android/app/build.gradle.kts
file looks like (only a portion shown):
android {
... ...
... ...
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
... ...
... ...
}
The project uses default values for other important config options, which are determined by file ``:
open class FlutterExtension {
val compileSdkVersion: Int = 36
val minSdkVersion: Int = 24
val targetSdkVersion: Int = 36
val ndkVersion: String = "27.0.12077973"
... ...
... ...
... ...
}
The AGP version is: "8.9.1"
Use this table to determine which Java version is supported by each Android API, and where to find details on which Java APIs are available.
(Source: Java versions in Android builds)
Android Java
14 (API 34) 17
13 (API 33) 11
12 (API 32) 11
I am trying to understand what sourceCompatibility
and targetCompatibility
options are in order to be able to configure them properly for my projects. As you can see my project targets API 36
but the Java version used is VERSION_11
. So, I suppose this table given in official documentation shows maximum supported Java version
! Please correct me if I am wrong. I read somewhere that source and target compatibility of Java also determines the Android Runtime (ART). How to select these versions for (1) scalability, (2) latest features?