Stay organized with collections
Save and categorize content based on your preferences.
CompileOptions
interface CompileOptions
Java compilation options.
Summary
Public properties |
String |
Java source files encoding.
|
Boolean |
Whether core library desugaring is enabled.
|
JavaVersion |
Language level of the java source code.
|
JavaVersion |
Version of the generated Java bytecode.
|
Public functions
Public properties
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# CompileOptions\n==============\n\n\n```\ninterface CompileOptions\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nJava compilation options.\n\nSummary\n-------\n\n| ### Public functions ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html)` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [sourceCompatibility](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/CompileOptions#sourceCompatibility(kotlin.Any))`(sourceCompatibility: `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`?)` Language level of the java source code. |\n| `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html)` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [targetCompatibility](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/CompileOptions#targetCompatibility(kotlin.Any))`(targetCompatibility: `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`?)` Version of the generated Java bytecode. |\n\n| ### Public properties ||\n|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [encoding](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/CompileOptions#encoding()) Java source files encoding. |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isCoreLibraryDesugaringEnabled](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/CompileOptions#isCoreLibraryDesugaringEnabled()) Whether core library desugaring is enabled. |\n| [JavaVersion](https://docs.gradle.org/current/javadoc/org/gradle/api/JavaVersion.html) | [sourceCompatibility](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/CompileOptions#sourceCompatibility()) Language level of the java source code. |\n| [JavaVersion](https://docs.gradle.org/current/javadoc/org/gradle/api/JavaVersion.html) | [targetCompatibility](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/CompileOptions#targetCompatibility()) Version of the generated Java bytecode. |\n\nPublic functions\n----------------\n\n### sourceCompatibility\n\n```\n@Incubating\nfun sourceCompatibility(sourceCompatibility: Any?): Unit\n```\n\nLanguage level of the java source code.\n\nSimilar to what [Gradle Java plugin](http://www.gradle.org/docs/current/userguide/java_plugin.html) uses. Formats supported are:\n\n- `\"1.6\"`\n\n- `1.6`\n\n- `JavaVersion.Version_1_6`\n\n- `\"Version_1_6\"`\n\n### targetCompatibility\n\n```\n@Incubating\nfun targetCompatibility(targetCompatibility: Any?): Unit\n```\n\nVersion of the generated Java bytecode.\n\nSimilar to what [Gradle Java plugin](http://www.gradle.org/docs/current/userguide/java_plugin.html) uses. Formats supported are:\n\n- `\"1.6\"`\n\n- `1.6`\n\n- `JavaVersion.Version_1_6`\n\n- `\"Version_1_6\"`\n\nPublic properties\n-----------------\n\n### encoding\n\n```\nval encoding: String\n```\n\nJava source files encoding. \n\n### isCoreLibraryDesugaringEnabled\n\n```\nval isCoreLibraryDesugaringEnabled: Boolean\n```\n\nWhether core library desugaring is enabled. \n\n### sourceCompatibility\n\n```\nval sourceCompatibility: JavaVersion\n```\n\nLanguage level of the java source code.\n\nSimilar to what [Gradle Java plugin](http://www.gradle.org/docs/current/userguide/java_plugin.html) uses. Formats supported are:\n\n- `\"1.6\"`\n\n- `1.6`\n\n- `JavaVersion.Version_1_6`\n\n- `\"Version_1_6\"`\n\n### targetCompatibility\n\n```\nval targetCompatibility: JavaVersion\n```\n\nVersion of the generated Java bytecode.\n\nSimilar to what [Gradle Java plugin](http://www.gradle.org/docs/current/userguide/java_plugin.html) uses. Formats supported are:\n\n- `\"1.6\"`\n\n- `1.6`\n\n- `JavaVersion.Version_1_6`\n\n- `\"Version_1_6\"`"]]