Android KTX

Android KTX는 Android Jetpack 라이브러리를 위한 Kotlin 확장 프로그램 모듈 세트였습니다. 각 모듈에는 -ktx 서픽스(예: androidx.core:core-ktx 또는 androidx.fragment:fragment-ktx)가 있었습니다. 이러한 모듈은 확장 함수, 코루틴 지원, 기타 Kotlin 기능을 기본 라이브러리에 추가했습니다.

AndroidX 라이브러리는 Kotlin 우선이며 KTX 확장 프로그램은 각 라이브러리의 기본 모듈로 이동하고 있습니다. 대부분의 라이브러리에서 -ktx 아티팩트는 안정화 버전이 있는 라이브러리의 버전부터 비어 있으며 필요하지 않습니다.

KTX 종속 항목 삭제

안정화 버전이 있는 라이브러리에서 라이브러리의 KTX 종속 항목을 삭제하려면 다음 단계를 따르세요.

  1. 안정화 버전이 있는 라이브러리 표에서 라이브러리를 찾습니다.
  2. 프로젝트에서 표에 있는 버전 또는 이후 버전의 기본 아티팩트를 사용하는지 확인합니다.
  3. -ktx 아티팩트를 표에 나열된 기본 아티팩트로 바꿉니다. 예를 들어 androidx.fragment:fragment-ktx을 androidx.fragment:fragment로 바꾸고 androidx.room:room-ktx을 androidx.room:room-runtime로 바꿉니다.

코드나 가져오기를 변경할 필요가 없습니다. 확장 프로그램은 동일한 패키지 이름을 유지합니다.

안정화 버전이 있는 라이브러리

이러한 라이브러리의 경우 기본 아티팩트에는 안정화 버전의 확장 프로그램이 포함됩니다. -ktx 종속 항목을 삭제할 수 있습니다.

KTX 아티팩트 기본 아티팩트 버전부터 비어 있음
androidx.activity:activity-ktxandroidx.activity:activity1.9.0
androidx.collection:collection-ktxandroidx.collection:collection1.3.0
androidx.core:core-ktxandroidx.core:core1.19.0
androidx.fragment:fragment-ktxandroidx.fragment:fragment1.9.0
androidx.lifecycle:lifecycle-livedata-ktxandroidx.lifecycle:lifecycle-livedata2.7.0
androidx.lifecycle:lifecycle-livedata-core-ktxandroidx.lifecycle:lifecycle-livedata-core2.8.0
androidx.lifecycle:lifecycle-reactivestreams-ktxandroidx.lifecycle:lifecycle-reactivestreams2.6.0
androidx.lifecycle:lifecycle-runtime-ktxandroidx.lifecycle:lifecycle-runtime2.8.0
androidx.lifecycle:lifecycle-viewmodel-ktxandroidx.lifecycle:lifecycle-viewmodel2.8.0
androidx.navigation:navigation-fragment-ktxandroidx.navigation:navigation-fragment2.4.0
androidx.navigation:navigation-runtime-ktxandroidx.navigation:navigation-runtime2.4.0
androidx.navigation:navigation-ui-ktxandroidx.navigation:navigation-ui2.4.0
androidx.paging:paging-common-ktxandroidx.paging:paging-common3.0.0
androidx.paging:paging-runtime-ktxandroidx.paging:paging-runtime3.0.0
androidx.paging:paging-rxjava2-ktxandroidx.paging:paging-rxjava23.0.0
androidx.palette:palette-ktxandroidx.palette:palette1.1.0
androidx.room:room-ktxandroidx.room:room-runtime2.7.0
androidx.savedstate:savedstate-ktxandroidx.savedstate:savedstate1.3.0
androidx.sqlite:sqlite-ktxandroidx.sqlite:sqlite2.7.0
androidx.tracing:tracing-ktxandroidx.tracing:tracing1.3.0
androidx.work:work-runtime-ktxandroidx.work:work-runtime2.9.0

안정화 버전이 없는 라이브러리

이러한 라이브러리의 경우 기본 아티팩트에는 안정화 버전의 KTX 확장 프로그램이 포함되지 않습니다. 안정화 버전에 포함될 때까지 -ktx 종속 항목을 유지합니다.

KTX 아티팩트 기본 아티팩트
androidx.concurrent:concurrent-futures-ktxandroidx.concurrent:concurrent-futures
androidx.dynamicanimation:dynamicanimation-ktxandroidx.dynamicanimation:dynamicanimation
androidx.preference:preference-ktxandroidx.preference:preference
androidx.transition:transition-ktxandroidx.transition:transition
androidx.wear.watchface:watchface-complications-data-source-ktxandroidx.wear.watchface:watchface-complications-data-source

기본 모듈로 이동하지 않는 라이브러리

androidx.appsearch:appsearch-ktx 아티팩트가 모든 버전에서 비어 있습니다. 삭제할 수 있습니다.

androidx.security:security-crypto 라이브러리의 모든 공개 API가 KTX 모듈과 함께 지원 중단되었습니다. KTX 확장 프로그램은 기본 모듈로 이동하지 않습니다. 프로젝트에서 라이브러리를 삭제합니다.