Home > other >  What is the difference between sourceCompatibility 8 and 11? What happens when they are set to diffe
What is the difference between sourceCompatibility 8 and 11? What happens when they are set to diffe

Time:09-04

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.

CodePudding user response:

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

  • Related