3

When I target Android API level 21 what I set as sourceCompatibility 11 or 8 and what's the differences in my build gradle I always set it like that

 compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

but on android studio Electric Eel it says: Starting with Android Gradle plugin 7.4.0-alpha04, AGP ships wth JVM 11 bytecode.

JulianHarty
  • 3,178
  • 3
  • 32
  • 46
devio
  • 607
  • 9
  • 29

1 Answers1

5

When you set your compile options to

compileOptions {
    sourceCompatibility JavaVersion.VERSION_11
    targetCompatibility JavaVersion.VERSION_11
}

you will be able to compile with Java 11 language features

InnisBrendan
  • 2,079
  • 2
  • 19
  • 21