Daiwik Daarun
Daiwik Daarun

Reputation: 3974

Configuring gradle compileOptions

My project's gradle file has the following:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

What would the sourceCompatibility / targetCompatibility be if this value was not set (how can you check this)? How is it that these values can be changed? Do all android devices have Java 1.6 and 1.7 installed?

Upvotes: 1

Views: 4290

Answers (2)

Gowtham
Gowtham

Reputation: 197

sourceCompatibility specifies that version of the Java programming language be used to compile .java files.

Default value of sourceCompatibility is the version of the current JVM in use.

Default value of targetCompatibility is sourceCompatibility.

Upvotes: 1

Geralt_Encore
Geralt_Encore

Reputation: 3771

For example, you can use Java 8 lambdas on Android via Retrolambda with this config:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Upvotes: 0

Related Questions