2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
SDK 확장 프로그램
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
SDK 확장 프로그램 모듈은 기기의 확장 SDK 수준을 결정하고 앱이 확장 SDK 수준을 쿼리할 수 있는 API를 제공합니다. 이 모듈은 업데이트할 수 있습니다. 즉, 일반적인 Android 출시 주기 외에도 기능 업데이트를 받을 수 있습니다.
SDK 확장 프로그램의 역할:
- 기기의 확장 SDK 수준 결정
- 앱이 확장 SDK 수준을 쿼리할 수 있는 API 제공
- (Android 12 이상)
BOOTCLASSPATH
, DEX2OATBOOTCLASSPATH
, SYSTEMSERVERCLASSPATH
환경 변수의 값 결정
SDK 확장 프로그램 모듈(com.android.sdkext
)은 APEX 형식이며 Android 11 이상을 실행하는 기기에서 사용할 수 있습니다.
SDK 확장 프로그램 모듈(com.google.android.sdkext
)은 APEX 형식이며 다음 구성요소를 포함합니다.
(Android 12 이상) bin/derive_classpath
: 기기 부팅 프로세스 초기에 실행되는 네이티브 바이너리입니다. 이 바이너리는 시스템 및 다른 모듈에서 개별 클래스 경로 구성 파일을 읽고 병합하며 CLASSPATH
환경 변수의 정의를 정의합니다.
bin/derive_sdk
: 이 네이티브 바이너리는 기기 부팅 프로세스 초기에 실행되며 다른 모듈의 메타데이터를 읽어 확장 SDK와 관련된 시스템 속성(예: build.version.extensions.r
)을 설정합니다.
javalib/framework-sdkextension.jar
: 이 파일은 확장 SDK 수준을 쿼리할 수 있도록 API를 앱에 노출하는 bootclasspath에 있습니다.
확장 프로그램 SDK 수준 도출
derive_sdk
프로그램은 각 APEX 모듈 내의 etc/sdkinfo.binarypb
하위 경로에 바이너리 protobuf 파일로 저장된 메타데이터를 읽습니다. protobuf 구조에 관한 자세한 내용은 protobuf
파일을 참고하세요.
확장 SDK 수준 읽기
SDK 확장 프로그램 모듈은 android.os.ext
패키지의 SdkExtensions
자바 클래스를 노출합니다. getExtensionVersion(int)
메서드를 사용하여 SDK 확장 프로그램의 버전을 읽습니다(예: getExtensionVersion(Build.VERSION_CODES.R)
).
클래스 경로 도출
derive_classpath
서비스는 /system/etc/classpaths/
및 /apex/*/etc/classpaths/
에 있는 개별 구성 파일을 읽고 병합합니다. 각 구성은 classpaths.proto
의 protobuf 메시지를 proto 바이너리 형식으로 저장합니다. 클래스 경로 항목의 순서를 결정하는 정확한 병합 알고리즘은 derive_classpath.cpp
에 설명되어 있으며 시간이 지남에 따라 변경될 수 있습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 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,["# SDK Extensions\n\nThe SDK Extensions module decides the extension SDK level of the device and\nprovides APIs for apps to query the extension SDK level. This module is\nupdatable, meaning it can receive updates to functionality outside of the normal\nAndroid release cycle.\n\nSDK Extensions is responsible for:\n\n- Deciding the extension SDK level of the device.\n- Providing APIs for apps to query the extension SDK level.\n- (Starting Android 12) Determining the values for the `BOOTCLASSPATH`, `DEX2OATBOOTCLASSPATH`, and `SYSTEMSERVERCLASSPATH` environment variables.\n\nModule format\n-------------\n\nThe SDK Extensions module (`com.android.sdkext`) is in\n[APEX](/docs/core/ota/apex) format and is available for devices\nrunning Android 11 or higher.\n\nPackage format\n--------------\n\nThe SDK Extensions module (`com.google.android.sdkext`) is in\n[APEX](/devices/tech/ota/apex) format and\ncontains the following components:\n\n- (Starting Android 12) `bin/derive_classpath`: A\n native binary that runs early in the device boot\n process. It reads individual classpath configs files from the system and\n other modules, merges them, and defines the definition of `CLASSPATH`\n environment variables.\n\n- `bin/derive_sdk`: A native binary that runs early in the device boot process\n and reads metadata of other modules to set system properties related to the\n extension SDK (for example, `build.version.extensions.r`).\n\n- `javalib/framework-sdkextension.jar`: This file is on the bootclasspath that\n exposes APIs to apps to query the extension SDK level.\n\nDerive extension SDK level\n--------------------------\n\nThe `derive_sdk` program reads metadata stored as binary protobuf files in the\n`etc/sdkinfo.binarypb` subpath inside each APEX module. For details on protobuf\nstructure, refer to the\n[`protobuf`](https://android.googlesource.com/platform/external/protobuf.git)\nfile.\n\nRead extension SDK level\n------------------------\n\nThe SDK Extensions module exposes an\n[`SdkExtensions`](https://android.googlesource.com/platform/packages/modules/SdkExtensions/)\njava class in the `android.os.ext` package. Use the `getExtensionVersion(int)`\nmethod to read the version of an SDK extension (for example,\n`getExtensionVersion(Build.VERSION_CODES.R)`).\n\nDerive classpaths\n-----------------\n\nThe `derive_classpath` service reads and merges individual config files in\n`/system/etc/classpaths/` and `/apex/*/etc/classpaths/`. Each config stores\nprotobuf message from [`classpaths.proto`](https://android.googlesource.com/platform/packages/modules/common/+/android16-release/proto/classpaths.proto)\nin a proto binary format. The exact merging algorithm that determines the order\nof the classpath entries is described in\n[`derive_classpath.cpp`](https://android.googlesource.com/platform/packages/modules/SdkExtensions/+/android16-release/derive_classpath/derive_classpath.cpp)\nand might change over time."]]