Support Library와 Androidx와 Jetpack

강민아·2024년 1월 16일
post-thumbnail

Support Library

필요성


  • API의 하위 호환성 문제를 해결하기 위해 만들어짐 ex) RecyclerView
    • API 21 이하에서 사용할 수 없었지만
      com.android.support:recyclerview-v7:28.0.0
      해당 support Library의 추가로 API 7부터도 사용할 수 있게 되었음

문제점


  • 최소 지원 API 레벨 문제
    • support Library Version 26.0.0부터는 API 레벨 14부터 지원가능
    • 너무 오래된 기종의 사용을 막기 위함이었지만 v7(기존에는 API 7부터 지원)도 최소 지원이 API 14가 되는 문제가 발생함
  • 필요없는 라이브러리의 추가
    • 사용하지 않아도 추가되면서 낭비가 생김
  • 버전 통일 문제
    • 복수 개의 support library를 사용하게 되면 모든 support library의 버전을 통일해야하는 문제가 생겼음

해결 (Androidx 체계의 도입)


위의 문제들을 해결하기 위해 2018년에 Google I/O세션 Android Jetpack: What’s new in Android Support Library에서 Library Packaging 방식의 변경을 발표하였음

이를 통해

Support Library는 Android Extension Libraries로 바뀌며 Androidx라는 명칭을 부여 받게 됨

Androidx의 원칙


  1. 라이브러리의 기능별 분리
    • support-core-ui → asynclayoutinflater, drawerlayout, interpolator, cursoradapter,
      customview, slideingpanellayout, swiperefreshlayout, viewpager
    • ex) viewpager가 필요하면 viewpager를 바로 임포트 가능
  2. 버저닝 방식의 변경
    • API 레벨과 동기화되어 올라가던 버저닝 방식이 28.0.0부터 1.0.0으로 리셋됨
    • Major.Minor.Patch 형식의 Semantic Versioning을 준수하게 됨 📖 1. MAJOR version when you make incompatible API changes 1. MINOR version when you add functionality in a backwards compatible manner 2. PATCH version when you make backwards compatible bug fixes
    • Library 전체 변경이 아닌 Artifact당 버전 변경이 이루어지기 때문에 예를 들면 RecyclerView의 업데이트가 이루어지면 RecyclerView 패키지만을 개별적으로 업데이트가 가능해짐
  3. 패키징 방식 변경
    • 어떤 기능을 가졌는지 알수 없었던 Support library
      ex) android.support.v7.app
    • 패키지 이름이 기능을 나타내도록 변경됨
      • Java Package : androidx..ClassName
      • Maven id : androidx.:-
      • Class Mappings, Artifact Mappings
    • 업데이트 확인
      • Androidx의 최신 릴리즈 내용 : Recent Release Notes
      • 개별 커밋 Github

Jetpack

📖 Android app을 좀 더 완성도 높게 만들 수 있는 Library의 모음

ref) https://android-developers.googleblog.com/2018/05/use-android-jetpack-to-accelerate-your.html

스크린샷 2023-03-03 오후 5.20.42.png

각 Component는 개별적으로 App애서도 사용이 가능하며 이전 버전과도 호환성을 유지할 수 있게 구성됨

Jetpack의 특징


  • Modern App Architecture
  • Eliminate Boiler Plate Code
  • Simplifying Complex Tasks
  • Robust Backwards Compatibility

출처


강의

냉동코더의 알기 쉬운 Modern Android Development 입문 강의 - 인프런

출처 : 냉동코더의 알기 쉬운 Modern Android Development 입문

코드

https://github.com/cliearl/book-search-app

Designed and developed by 2022 FrozenCoder

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

썸네일 사진

UnsplashMohamed Nohassi

profile
개발자꿈나무

0개의 댓글