Compose 컴파일러 Gradle 플러그인
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Gradle 사용자의 경우 Compose 컴파일러 Gradle 플러그인을 사용하여 Compose를 더 쉽게 설정하고 구성할 수 있습니다.
Gradle 버전 카탈로그로 설정
다음 안내는 Compose 컴파일러 Gradle 플러그인을 설정하는 방법을 간략히 설명합니다.
libs.versions.toml
파일에서 Compose 컴파일러 참조를 삭제합니다.
- 플러그인 섹션에 다음과 같은 새 종속 항목을 추가합니다.
[versions]
kotlin = "2.0.0"
[plugins]
org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
// Add this line
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
- 프로젝트 루트
build.gradle.kts
파일에서 플러그인 섹션에 다음을 추가합니다.
plugins {
// Existing plugins
alias(libs.plugins.compose.compiler) apply false
}
- Compose를 사용하는 각 모듈에서 플러그인을 적용합니다.
plugins {
// Existing plugins
alias(libs.plugins.compose.compiler)
}
이제 기본 설정을 사용하는 경우 앱이 빌드되고 컴파일됩니다. Compose 컴파일러에서 맞춤 옵션을 구성한 경우 다음 섹션을 참고하세요.
Gradle 버전 카탈로그 없이 설정
버전 카탈로그 없이 Compose 컴파일러 Gradle 플러그인을 설정하려면 Compose를 사용하는 모듈과 연결된 build.gradle.kts
파일에 다음 플러그인을 추가합니다.
plugins {
id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" // this version matches your Kotlin version
}
Compose 컴파일러 Gradle 플러그인의 구성 옵션
Gradle 플러그인을 사용하여 Compose 컴파일러를 구성하려면 최상위 수준의 모듈 build.gradle.kts
파일에 composeCompiler
블록을 추가합니다.
android { … }
composeCompiler {
reportsDestination = layout.buildDirectory.dir("compose_compiler")
stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
}
사용 가능한 옵션의 전체 목록은 문서를 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Compose Compiler Gradle plugin\n\nFor Gradle users, you can use the Compose Compiler Gradle plugin to make setting\nup and configuring Compose easier.\n| **Note:** The Compose Compiler Gradle Plugin is only available from Kotlin 2.0+. For migration instructions, see [\"Jetpack Compose compiler moving to the Kotlin\n| repository\"](https://android-developers.googleblog.com/2024/04/jetpack-compose-compiler-moving-to-kotlin-repository.html). For an example migration, see the [Compose Samples\n| PR](https://github.com/android/compose-samples/pull/1354) in the Compose samples.\n\nSet up with Gradle version catalogs\n-----------------------------------\n\nThe following instructions outline how you can set up the Compose Compiler\nGradle plugin:\n\n1. In your `libs.versions.toml` file, remove any reference to the Compose compiler\n2. In the plugins section, add the following new dependency\n\n [versions]\n kotlin = \"2.0.0\"\n\n [plugins]\n org-jetbrains-kotlin-android = { id = \"org.jetbrains.kotlin.android\", version.ref = \"kotlin\" }\n\n // Add this line\n compose-compiler = { id = \"org.jetbrains.kotlin.plugin.compose\", version.ref = \"kotlin\" }\n\n1. In your projects root `build.gradle.kts` file, add the following to the plugins section:\n\n plugins {\n // Existing plugins\n alias(libs.plugins.compose.compiler) apply false\n }\n\n1. In each module that uses Compose, apply the plugin:\n\n plugins {\n // Existing plugins\n alias(libs.plugins.compose.compiler)\n }\n\nYour app should now build and compile if you are using the default set up. If\nyou had configured custom options on the Compose compiler, see the following\nsection.\n\nSet up without Gradle version catalogs\n--------------------------------------\n\nTo set up the Compose Compiler Gradle plugin without version catalogs, add the\nfollowing plugin to `build.gradle.kts` files associated with modules you use\nCompose: \n\n plugins {\n id(\"org.jetbrains.kotlin.plugin.compose\") version \"2.0.0\" // this version matches your Kotlin version\n }\n\nConfiguration options with the Compose Compiler Gradle Plugin\n-------------------------------------------------------------\n\nTo configure the Compose compiler using the Gradle plugin, add the\n`composeCompiler` block to the module's `build.gradle.kts` file at the top\nlevel. \n\n android { ... }\n\n composeCompiler {\n reportsDestination = layout.buildDirectory.dir(\"compose_compiler\")\n stabilityConfigurationFile = rootProject.layout.projectDirectory.file(\"stability_config.conf\")\n }\n\nFor the full list of available options, see the [documentation](https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compiler.html#compose-compiler-options-dsl)."]]