지원 라이브러리
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
참고: Android 9.0(API 수준 28)의 출시와 함께 Jetpack의 일부인 새로운 버전의 지원 라이브러리 AndroidX가 출시됩니다.
AndroidX 라이브러리는 기존 지원 라이브러리를 포함하며 최신 Jetpack 구성요소 또한 포함합니다.
지원 라이브러리를 계속 사용할 수 있습니다.
이전 아티팩트(버전 27 이상이며 android.support.*
로 패키징됨)는 Google Maven에서 계속 사용할 수 있습니다. 그러나 모든 새 라이브러리 개발은 AndroidX 라이브러리에서 진행됩니다.
모든 신규 프로젝트에서 AndroidX 라이브러리를 사용하는 것이 좋습니다. 기존 프로젝트를 AndroidX로 이전하는 것 또한 고려해보세요.
여러 API 버전을 지원하는 앱을 개발할 때 이전 Android 버전에서 최신 기능을 제공하거나 그와 동일한 기능으로 대체하는 표준 방법이 필요할 수도 있습니다. 이전 버전의 플랫폼을 처리하는 코드를 빌드하는 대신 지원 라이브러리를 활용하여 호환성 계층을 제공할 수 있습니다. 또한 지원 라이브러리는 표준 프레임워크 API에서는 사용할 수 없었던 손쉬운 개발 및 여러 기기에 걸친 지원을 위한 추가 편의 클래스 및 기능을 제공합니다.
원래 앱용 단일 바이너리 라이브러리였던 Android 지원 라이브러리는 앱 개발을 위한 일련의 라이브러리로 발전했습니다. 이러한 라이브러리 대다수는 앱 개발의 필수적인 요소는 아니지만 사용하는 것이 좋습니다.
이 문서에서는 지원 라이브러리를 간략하게 설명하여 지원 라이브러리의 구성요소와 이를 앱에서 효과적으로 사용하는 방법을 이해하도록 돕습니다.
주의: 지원 라이브러리 버전 26.0.0(2017년 7월)부터 대부분의 라이브러리 패키지를 대상으로 대부분의 지원 라이브러리가 지원하는 최소 API 수준은 Android 4.0(API 수준 14)으로 증가했습니다. 대상
자세한 내용은 버전 지원 및 패키지를 참조하세요.
이름을 참조하세요.
지원 라이브러리의 용도
지원 라이브러리는 몇 가지 뚜렷한 용도가 있습니다. 이전 버전의 플랫폼을 위한 하위 호환성 클래스는 그중 하나입니다. 앱에서 지원 라이브러리를 사용할 수 있는 더 자세한 방법은 다음과 같습니다.
-
새로운 API에 관한 하위 호환성 - 지원 라이브러리의 많은 부분은 최신 프레임워크 클래스 및 메서드를 위한 하위 호환성을 제공합니다. 예를 들어
Fragment
지원 클래스는 Android 3.0(API 수준 11) 이전 버전을 실행하는 기기에서 프래그먼트를 지원합니다.
-
편의 및 도우미 클래스 - 이 지원 라이브러리는 다양한 도우미 클래스, 특히 사용자 인터페이스 개발용 도우미 클래스를 제공합니다. 대상
RecyclerView
클래스가 사용자에게 제공하는 예
매우 긴 목록을 표시하고 관리하기 위한 인터페이스 위젯으로,
API 수준 7 이상의 Android 버전을 지원합니다.
- 디버깅 및 유틸리티 - 메서드 입력에서 개선된 코드 린트 검사를 위한
support-annotations
라이브러리와 메서드가 65,536개가 넘는 앱 구성 및 배포를 위한 멀티덱스 지원을 포함하여, 앱에 통합된 코드 외의 유틸리티를 제공하는 다양한 기능이 있습니다.
지원 사용 vs 프레임워크 API
지원 라이브러리는 Android 프레임워크에서 API와 매우 유사한 클래스와 메서드를 제공합니다. 이를 발견하면 API의 프레임워크 버전을 사용해야 할지, 이와 동등한 지원 라이브러리를 사용해야 할지 고민할 수 있습니다. 다음은 언제 프레임워크 API 대신 지원 라이브러리 클래스를 사용해야 하는지에 관한 지침입니다.
- 특정 기능과 호환성 - 플랫폼의 이전 버전을 실행 중인 기기에서 최근 플랫폼 기능을 지원하려면 지원 라이브러리에서 동등한 클래스와 메서드를 사용합니다.
-
관련 라이브러리 기능과 호환성 - 더 정교한 지원 라이브러리 클래스는 추가 지원 라이브러리 한 개 이상에 종속될 수 있으므로 이를 위해서 지원 라이브러리를 사용해야 합니다. 예를 들어
ViewPager
지원 클래스는 FragmentPagerAdapter
또는 FragmentStatePagerAdapter
지원 클래스와 함께 사용해야 합니다.
- 일반 기기와 호환성 - 이전 버전과의 호환성 측면에서 앱과 함께 사용할 특정 플랫폼 기능이 없어도 앱에 지원 라이브러리 클래스를 사용하는 것이 좋습니다. 예를 들어 Android 6.0(API 수준 23)에서 도입된 새로운 권한 모델 통합과 같이 추후 새로운 기능을 최대한 활용하기 위해서는 프레임워크
Activity
클래스 대신 ActivityCompat
을 사용해야 합니다.
플랫폼 API 클래스의 호환성 구현을 제공하는 지원 라이브러리 클래스는 호스트 기기 플랫폼 버전의 제한으로 인해 최신 버전의 모든 기능을 제공하지 못할 수도 있습니다. 이와 같은 경우 지원 라이브러리 클래스는 단계적으로 성능이 저하되도록 설계되었으며 최신 플랫폼 API의 모든 기능이나 데이터를 제공하지 못할 수도 있습니다. 이와 같은 이유로 참조 문서에서 사용하는 라이브러리 클래스와 메서드를 검토해야 하며 앱이 지원하는 가장 오래된 버전의 플랫폼을 실행하는 기기에서 철저하게 테스트해야 합니다.
참고: 지원 라이브러리는 각 프레임워크 API마다 동등한 클래스와 메서드를 제공하지 않습니다. 경우에 따라 기기에서 사용할 수 없는 메서드를 처리하기 위해 프레임워크 메서드 호출을 명시적 SDK 버전 확인으로 래핑하고 대체 코드를 제공해야 할 수도 있습니다. 코드에 버전 확인을 사용하는 방법에 관한 자세한 내용은 다양한 플랫폼 버전 지원을 참고하세요.
버전 지원 및 패키지 이름
일부 지원 라이브러리 패키지는 support-v4 패키지처럼 v# 표기법으로 원래 지원하는 최소 API 수준을 나타내는 패키지 이름으로 되어 있습니다. 지원 라이브러리 버전 26.0.0(2017년 7월 버전)부터 모든 지원 라이브러리 패키지 대상으로 지원되는 최소 API 수준이 Android 4.0(API 수준 14)으로 변경되었습니다. 이러한 이유로 지원 라이브러리의 최신 버전을 사용할 때 v# 패키지 표기법이 최소 API 지원 수준을 나타낸다고 볼 수 없습니다.
최신 버전의 이러한 변화는 v4와 v7 라이브러리 패키지가 동일한 최소 API 수준을 지원한다는 것을 의미합니다.
예를 들어 26.0.0 이상 버전의 지원 라이브러리에 관해서 support-v4 패키지와 support-v7 패키지는 모두 최소 API 수준 14를 지원합니다.
지원 라이브러리 출시 버전
지원 라이브러리의 출시 버전(예: 24.2.0 또는 25.0.1)은 이 버전의 라이브러리가 지원하는 최소 API 수준과 다릅니다. 출시 버전 번호는 라이브러리가 빌드된 플랫폼 API 버전을 나타내므로 이 버전의 라이브러리에 포함될 수 있는 가장 최근 API를 나타냅니다.
특히 버전 24.2.0에서 24와 같은 출시 버전 번호의 첫 번째 부분은 출시 당시 사용할 수 있었던 플랫폼 API의 버전과 일치합니다. 지원 라이브러리의 출시 버전 수준은 이 API 수준의 일부 기능을 포함한다는 것을 보여주지만 이것이 새로운 플랫폼 API 버전에 출시된 모든 기능과 호환될 것이라고 가정하면 안 됩니다.
라이브러리 종속 항목
Android 지원 라이브러리 모음의 대부분 라이브러리는 라이브러리 하나 이상에 종속됩니다. 예를 들어 거의 모든 지원 라이브러리는 support-compat
패키지에 종속됩니다. 일반적으로 gradle 빌드 도구가 종속되는 라이브러리를 자동으로 포함하여 라이브러리 종속 항목을 관리하기 때문에 지원 라이브러리 종속 항목을 걱정하지 않아도 됩니다.
어떤 라이브러리와 라이브러리 종속 항목이 앱에 추가되는지 확인하고 싶으면 다음 명령어를 앱 개발 프로젝트의 빌드 루트에서 실행하여 Android 지원 라이브러리와 다른 라이브러리를 포함하여 프로젝트의 종속 항목 보고서를 가져옵니다.
gradle -q dependencies your-app-project:dependencies
Gradle로 개발 프로젝트에 지원 라이브러리를 추가하는 방법을 자세히 알아보려면 지원 라이브러리 설정을 참고하세요. Gradle 작업에 관한 자세한 내용은 빌드 구성을 참고하세요.
Android 4.0(API 수준 14) 이상의 최신 버전의 경우 모든 Android 지원 라이브러리가 플랫폼의 기본 수준에 종속된다는 점을 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2024-08-23(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"]],["최종 업데이트: 2024-08-23(UTC)"],[],[],null,["# Support Library\n\n**Note:** With the release of Android 9.0 (API level 28) there is\na new version of the support library called\n[AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack).\nThe AndroidX library\ncontains the existing support library and also includes the latest Jetpack components.\n\n\u003cbr /\u003e\n\n\nYou can continue to use the support library.\nHistorical artifacts (those versioned 27 and earlier, and packaged as `android.support.*`) will\nremain available on Google Maven. However, all new library development\nwill occur in the [AndroidX](/jetpack/androidx) library.\n\n\u003cbr /\u003e\n\n\nWe recommend using the AndroidX libraries in all new projects. You should also consider\n[migrating](/jetpack/androidx/migrate) existing projects to AndroidX as well.\n\n\nWhen developing apps that support multiple API versions, you may want a\nstandard way to provide newer features on earlier versions of Android or\ngracefully fall back to equivalent functionality. Rather than building code\nto handle earlier versions of the platform, you can leverage these libraries\nto provide that compatibility layer. In addition, the Support Libraries\nprovide additional convenience classes and features not available in the\nstandard Framework API for easier development and support across more\ndevices.\n\n\nOriginally a single binary library for apps, the Android Support Library has\nevolved into a suite of libraries for app development. Many of these\nlibraries are now a strongly recommended, if not essential, part of app\ndevelopment.\n\n\nThis document provides an overview of the support library to help you\nunderstand its components and how to use it effectively in your app.\n\n\n**Caution:** Starting with Support Library release 26.0.0\n(July 2017), the minimum supported API level across most support libraries\nhas increased to Android 4.0 (API level 14) for most library packages. For\nmore information, see [Version Support and Package\nNames](#api-versions) on this page.\n\nUses for the Support Libraries\n------------------------------\n\n\nThere are a few distinct uses for the support libraries. Backward\ncompatibility classes for earlier versions of the platform is just one of\nthem. Here is a more complete list of ways you can use the support libraries\nin your app:\n\n- **Backward Compatibility for newer APIs** - A large amount of the support libraries provide backward compatibility for newer framework classes and methods. For example, the [Fragment](/reference/androidx/fragment/app/Fragment) support class provides support for fragments on devices running versions earlier than Android 3.0 (API level 11).\n- **Convenience and Helper Classes** - The support libraries provides a number of helper classes, particularly for user interface development. For example the [RecyclerView](/reference/androidx/recyclerview/widget/RecyclerView) class provides a user interface widget for displaying and managing very long lists, useable on versions of Android from API level 7 and up.\n- **Debugging and Utilities** - There are a number of features that provide utility beyond code you incorporate into your app, including the [`support-annotations`](/studio/write/annotations) library for improved code lint checks on method inputs and [Multidex support](/studio/build/multidex) for configuring and distributing apps with over 65,536 methods.\n\nUsing Support versus Framework APIs\n-----------------------------------\n\n\nSupport Libraries provide classes and methods that closely resemble APIs in\nthe Android Framework. Upon discovering this, you may wonder if you should\nuse the framework version of the API or the support library equivalent. Here\nare the guidelines for when you should use support library classes in place\nof Framework APIs:\n\n- **Compatibility for a Specific Feature** - If you want to support a recent platform feature on devices that are running earlier versions of the platform, use the equivalent classes and methods from the support library.\n- **Compatibility for Related Library Features** - More sophisticated support library classes may depend on one or more additional support library classes, so you should use support library classes for those dependencies. For example, the [ViewPager](/reference/androidx/viewpager/widget/ViewPager) support class should be used with [FragmentPagerAdapter](/reference/androidx/fragment/app/FragmentPagerAdapter) or the [FragmentStatePagerAdapter](/reference/androidx/fragment/app/FragmentStatePagerAdapter) support classes.\n- **General Device Compatibility** - If you do not have a specific platform feature you intend to use with your app in a backward compatible way, it is still a good idea to use support library classes in your app. For example, you may want to use [ActivityCompat](/reference/androidx/core/app/ActivityCompat) in place of the framework [Activity](/reference/android/app/Activity) class, so you can take advantage of newer features later on, such as incorporating the new permissions model introduced in Android 6.0 (API level 23).\n\n\nSupport Library classes that provide a compatible implementation of platform\nAPI classes may not be able to provide the full set of functionality\navailable in the latest release, due to the limitations of the host device\nplatform version. In these cases, Support Library classes are designed to\ndegrade gracefully, and may not provide the all the functionality or data of\nthe current, platform API. For this reason, you should review the reference\ndocumentation for the library classes and methods you use, and thoroughly\ntest on devices running the earliest version of the platform supported by\nyour app.\n\n\n**Note:** The support libraries do not provide equivalent\nclasses and methods for each framework API. In some cases, you may need to\nwrap a framework method call with an explicit SDK version check and provide\nalternative code to handle methods not available on a device. For more\ninformation on using version checks in your code, see [Supporting Different\nPlatform Versions](/training/basics/supporting-devices/platforms).\n\nVersion Support and Package Names\n---------------------------------\n\n\nSome of the Support Library packages have package names to indicate the\nminimum level of the API they originally supported,\nusing a v# notation, such as the\nsupport-v4 package. Starting with Support Library version 26.0.0 (released in\nJuly 2017), the minimum supported API level has changed to Android 4.0 (API\nlevel 14) for all support library packages. For this reason, when working with\nany recent release of the support library, you should not assume that the\nthe *v#* package notation indicates a minimum API support level.\nThis change in recent releases also means that library packages with the v4\nand v7 are essentially equivalent in the minimum level of API they support.\nFor example, the support-v4 and the support-v7 package both support a minimum\nAPI level of 14, for releases of the Support Library from 26.0.0 and higher.\n\n### Support Library Release Versions\n\n\nThe [release version](/topic/libraries/support-library/revisions) of the Support Library, such as 24.2.0 or 25.0.1, is\ndifferent from the minimum API level supported by any library in that\nrelease.The release version number indicates which version of the platform\nAPI it was built against, and therefore, what the most recent APIs *may be\nincluded* in this version of the libraries.\n\n\nSpecifically, the first section of the release version number, for example\nthe 24 in version 24.2.0, generally corresponds with the version of the\nplatform API available when it was released. The release version level of the\nsupport library indicates it incorporates *some* features of that API\nlevel, but you should not assume it provides compatibility with *all*\nfeatures released in the new platform API version.\n\nLibrary Dependencies\n--------------------\n\n\nMost libraries in the Android Support Library suite have some dependency on\none or more libraries. For example, nearly all support libraries have a\ndependency on the `support-compat` package. In general, you do not\nneed to worry about support library dependencies, because the gradle build\ntool manages library dependencies for you, by automatically including\ndependent libraries.\n\n\nIf you want to see what libraries and library dependencies are included in\nyour app, run the following command at the build root of your app development\nproject to get a report of the dependencies for that project, including\nAndroid Support Libraries and other libraries: \n\n```\ngradle -q dependencies your-app-project:dependencies\n```\n\n\nFor more information about adding support libraries to your development\nproject using Gradle, see [Support\nLibrary Setup](/topic/libraries/support-library/setup). For more information about working with Gradle, see\n[Configure\nYour Build](/studio/build).\n\n\nNote that *all* Android Support Libraries also depend on some base level\nof the platform, for recent releases, that is Android 4.0 (API level 14) or\nhigher."]]