라이브러리의 기준 프로필 만들기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
라이브러리의 기준 프로필을 만들려면 기준 프로필 Gradle 플러그인을 사용하세요.
라이브러리의 기준 프로필 생성과 관련된 세 가지 모듈은 다음과 같습니다.
- 샘플 앱 모듈: 라이브러리를 사용하는 샘플 앱이 포함되어 있습니다.
- 라이브러리 모듈: 프로필을 생성하려는 모듈입니다.
- 기준 프로필 모듈: 기준 프로필을 생성하는 테스트 모듈입니다.
라이브러리의 기준 프로필을 생성하려면 다음 단계를 따르세요.
- 새
com.android.test
모듈을 만듭니다(예: :baseline-profile
).
:baseline-profile
모듈의 build.gradle.kts
파일을 구성합니다. 구성은 기본적으로 앱과 동일하지만 targetProjectPath
를 샘플 앱 모듈로 설정해야 합니다.
:baseline-profile
테스트 모듈에서 기준 프로필 테스트를 만듭니다. 이는 샘플 앱에만 해당하는 테스트여야 하며 라이브러리의 모든 기능을 사용해야 합니다.
- 라이브러리 모듈(예:
:library
)의 build.gradle.ktss
파일에서 구성을 업데이트합니다.
androidx.baselineprofile
플러그인을 적용합니다.
:baseline-profile
모듈에 baselineProfile
종속 항목을 추가합니다.
- 다음 예와 같이 원하는 소비자 플러그인 구성을 적용합니다.
Kotlin
plugins {
id("com.android.library")
id("androidx.baselineprofile")
}
android { ... }
dependencies {
...
// Add a baselineProfile dependency to the `:baseline-profile` module.
baselineProfile(project(":baseline-profile"))
}
// Baseline Profile Gradle plugin configuration.
baselineProfile {
// Filters the generated profile rules.
// This example keeps the classes in the `com.library` package all its subpackages.
filter {
include "com.mylibrary.**"
}
}
Groovy
plugins {
id 'com.android.library'
id 'androidx.baselineprofile'
}
android { ... }
dependencies {
...
// Add a baselineProfile dependency to the `:baseline-profile` module.
baselineProfile ':baseline-profile'
}
// Baseline Profile Gradle plugin configuration.
baselineProfile {
// Filters the generated profile rules.
// This example keeps the classes in the `com.library` package all its subpackages.
filter {
include 'com.mylibrary.**'
}
}
androidx.baselineprofile
플러그인을
앱 모듈의 build.gradle.kts
파일
:sample-app
입니다.
Kotlin
plugins {
...
id("androidx.baselineprofile")
}
Groovy
plugins {
...
id 'androidx.baselineprofile'
}
./gradlew :library:generateBaselineProfile
코드를 실행하여 프로필을 생성합니다.
생성 작업이 끝나면 기준 프로필이 library/src/main/generated/baselineProfiles
에 저장됩니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 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,["# Create Baseline Profiles for a library\n\nTo create Baseline Profiles for a library, use the\n[Baseline Profile Gradle plugin](/topic/performance/baselineprofiles/configure-baselineprofiles).\n\nThere are three modules involved in creating Baseline Profiles for a library:\n\n- Sample app module: contains the sample app that uses your library.\n- Library module: the module you want to generate the profile for.\n- Baseline Profile module: the test module that generates the Baseline Profiles.\n\nTo generate a Baseline Profile for a library, perform the following steps: \n1. Create a new `com.android.test` module---for example, `:baseline-profile`.\n2. Configure the `build.gradle.kts` file for the `:baseline-profile` module. [The configuration is\n essentially the same as for an app](/topic/performance/baselineprofiles/create-baselineprofile#create-new-profile-plugin), but make sure to set the `targetProjectPath` to the sample app module.\n3. Create a Baseline Profile test in the `:baseline-profile` test module. This needs to be specific to the sample app and must use all the functionalities of the library.\n4. Update the configuration in `build.gradle.ktss` file in the library module, say `:library`.\n 1. Apply the plugin `androidx.baselineprofile`.\n 2. Add a `baselineProfile` dependency to the `:baseline-profile` module.\n3. Apply the consumer plugin configuration you want, as shown in the following example. \n\n### Kotlin\n\n```kotlin\nplugins {\n id(\"com.android.library\")\n id(\"androidx.baselineprofile\")\n}\n\nandroid { ... }\n\ndependencies {\n ...\n // Add a baselineProfile dependency to the `:baseline-profile` module.\n baselineProfile(project(\":baseline-profile\"))\n}\n\n// Baseline Profile Gradle plugin configuration.\nbaselineProfile {\n\n // /topic/performance/baselineprofile/configure-baselineprofiles#filter-profile-rules the generated profile rules. \n // This example keeps the classes in the `com.library` package all its subpackages.\n filter {\n include \"com.mylibrary.**\"\n }\n}\n```\n\n### Groovy\n\n```groovy\nplugins {\n id 'com.android.library'\n id 'androidx.baselineprofile'\n}\n\nandroid { ... }\n\ndependencies {\n ...\n // Add a baselineProfile dependency to the `:baseline-profile` module.\n baselineProfile ':baseline-profile'\n}\n\n// Baseline Profile Gradle plugin configuration.\nbaselineProfile {\n\n // /topic/performance/baselineprofile/configure-baselineprofiles#filter-profile-rules the generated profile rules. \n // This example keeps the classes in the `com.library` package all its subpackages.\n filter {\n include 'com.mylibrary.**'\n }\n}\n```\n5. Add the `androidx.baselineprofile` plugin to the `build.gradle.kts` file in the app module `:sample-app`. \n\n ### Kotlin\n\n ```kotlin\n plugins {\n ...\n id(\"androidx.baselineprofile\")\n }\n ```\n\n ### Groovy\n\n ```groovy\n plugins {\n ...\n id 'androidx.baselineprofile'\n }\n ```\n6. Generate the profile by running the following code: `./gradlew :library:generateBaselineProfile`.\n\nAt the end of the generation task, the Baseline Profile is stored at\n`library/src/main/generated/baselineProfiles`."]]