Android KTX는 Android Jetpack 라이브러리를 위한 Kotlin 확장 프로그램 모듈 세트였습니다. 각 모듈에는 -ktx 서픽스(예: androidx.core:core-ktx 또는 androidx.fragment:fragment-ktx)가 있었습니다. 이러한 모듈은 확장 함수, 코루틴 지원, 기타 Kotlin 기능을 기본 라이브러리에 추가했습니다.
AndroidX 라이브러리는 Kotlin 우선이며 KTX 확장 프로그램은 각 라이브러리의 기본 모듈로 이동하고 있습니다. 대부분의 라이브러리에서 -ktx 아티팩트는 안정화 버전이 있는 라이브러리의 버전부터 비어 있으며 필요하지 않습니다.
KTX 종속 항목 삭제
안정화 버전이 있는 라이브러리에서 라이브러리의 KTX 종속 항목을 삭제하려면 다음 단계를 따르세요.
- 안정화 버전이 있는 라이브러리 표에서 라이브러리를 찾습니다.
- 프로젝트에서 표에 있는 버전 또는 이후 버전의 기본 아티팩트를 사용하는지 확인합니다.
-ktx아티팩트를 표에 나열된 기본 아티팩트로 바꿉니다. 예를 들어androidx.fragment:fragment-ktx을androidx.fragment:fragment로 바꾸고androidx.room:room-ktx을androidx.room:room-runtime로 바꿉니다.
코드나 가져오기를 변경할 필요가 없습니다. 확장 프로그램은 동일한 패키지 이름을 유지합니다.
안정화 버전이 있는 라이브러리
이러한 라이브러리의 경우 기본 아티팩트에는 안정화 버전의 확장 프로그램이 포함됩니다. -ktx 종속 항목을 삭제할 수 있습니다.
| KTX 아티팩트 | 기본 아티팩트 | 버전부터 비어 있음 |
|---|---|---|
androidx.activity:activity-ktx | androidx.activity:activity | 1.9.0 |
androidx.collection:collection-ktx | androidx.collection:collection | 1.3.0 |
androidx.core:core-ktx | androidx.core:core | 1.19.0 |
androidx.fragment:fragment-ktx | androidx.fragment:fragment | 1.9.0 |
androidx.lifecycle:lifecycle-livedata-ktx | androidx.lifecycle:lifecycle-livedata | 2.7.0 |
androidx.lifecycle:lifecycle-livedata-core-ktx | androidx.lifecycle:lifecycle-livedata-core | 2.8.0 |
androidx.lifecycle:lifecycle-reactivestreams-ktx | androidx.lifecycle:lifecycle-reactivestreams | 2.6.0 |
androidx.lifecycle:lifecycle-runtime-ktx | androidx.lifecycle:lifecycle-runtime | 2.8.0 |
androidx.lifecycle:lifecycle-viewmodel-ktx | androidx.lifecycle:lifecycle-viewmodel | 2.8.0 |
androidx.navigation:navigation-common-ktx | androidx.navigation:navigation-common | 2.4.0 |
androidx.navigation:navigation-fragment-ktx | androidx.navigation:navigation-fragment | 2.4.0 |
androidx.navigation:navigation-runtime-ktx | androidx.navigation:navigation-runtime | 2.4.0 |
androidx.navigation:navigation-ui-ktx | androidx.navigation:navigation-ui | 2.4.0 |
androidx.paging:paging-common-ktx | androidx.paging:paging-common | 3.0.0 |
androidx.paging:paging-runtime-ktx | androidx.paging:paging-runtime | 3.0.0 |
androidx.paging:paging-rxjava2-ktx | androidx.paging:paging-rxjava2 | 3.0.0 |
androidx.palette:palette-ktx | androidx.palette:palette | 1.1.0 |
androidx.room:room-ktx | androidx.room:room-runtime | 2.7.0 |
androidx.savedstate:savedstate-ktx | androidx.savedstate:savedstate | 1.3.0 |
androidx.sqlite:sqlite-ktx | androidx.sqlite:sqlite | 2.7.0 |
androidx.tracing:tracing-ktx | androidx.tracing:tracing | 1.3.0 |
androidx.work:work-runtime-ktx | androidx.work:work-runtime | 2.9.0 |
안정화 버전이 없는 라이브러리
이러한 라이브러리의 경우 기본 아티팩트에는 안정화 버전의 KTX 확장 프로그램이 포함되지 않습니다. 안정화 버전에 포함될 때까지 -ktx 종속 항목을 유지합니다.
| KTX 아티팩트 | 기본 아티팩트 |
|---|---|
androidx.concurrent:concurrent-futures-ktx | androidx.concurrent:concurrent-futures |
androidx.dynamicanimation:dynamicanimation-ktx | androidx.dynamicanimation:dynamicanimation |
androidx.preference:preference-ktx | androidx.preference:preference |
androidx.transition:transition-ktx | androidx.transition:transition |
androidx.wear.watchface:watchface-complications-data-source-ktx | androidx.wear.watchface:watchface-complications-data-source |
기본 모듈로 이동하지 않는 라이브러리
androidx.appsearch:appsearch-ktx 아티팩트가 모든 버전에서 비어 있습니다. 삭제할 수 있습니다.
androidx.security:security-crypto 라이브러리의 모든 공개 API가 KTX 모듈과 함께 지원 중단되었습니다. KTX 확장 프로그램은 기본 모듈로 이동하지 않습니다. 프로젝트에서 라이브러리를 삭제합니다.