수십억 사용자를 위한 데이터 비용 절감
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
일부 국가에서는 데이터 요금제가 일반적인 사용자의 매달 수입의 10%를 상회할 수 있습니다. 이는 다시 말해 앱의 다운로드 크기를 최소화하고 사용자가 앱의 데이터 사용 방식을 제어할 수 있게 하면 많은 사용자에게 커다란 실질적 이점을 제공할 수 있다는 뜻입니다. 다운로드 크기를 최소화하면 내부 저장소에 공간을 보전하는 데에도 도움이 됩니다. 이는 몇몇 기기의 경우 귀한 리소스입니다.
여기에서는 네트워크 및 내부 저장소에서 앱이 사용하는 데이터의 양을 최적화하는 데 유용한 몇 가지 전략을 소개합니다.
앱 크기 축소
앱 크기 축소는 사용자가 네트워크 데이터 및 내부 저장소 둘 모두에서 적은 양의 데이터를 소비하도록 돕는 기본적인 방식 중 하나입니다. 이 섹션에서는 앱 크기를 줄이는 몇 가지 방법을 설명합니다.
APK 그래픽 저작물의 크기 축소
- 대개 그래픽 저작물은 APK 크기의 가장 큰 부분을 차지합니다. 이러한 저작물을 최적화하면 다운로드 크기가 더 작아지고 따라서 사용자의 설치 시간이 더 빨라집니다.
- 아이콘과 같은 그래픽 저작물의 경우 Scalable Vector Graphics(SVG) 형식을 사용하세요. SVG 이미지는 비트맵 그래픽에 비해 크기가 매우 작고 런타임 시 어떤 해상도로도 렌더링될 수 있습니다. Android 지원 라이브러리는 이전 버전과 호환되는 벡터 리소스 구현을 Android 2.1(API 수준 7)에 제공합니다.
이 미디어 게시물에서 벡터를 시작해 보세요.
- 벡터 외의 이미지(예: 사진)의 경우, WebP를 사용하면 이미지 로드 시간을 단축하고 네트워크 대역폭을 절약할 수 있습니다. WebP는 같은 이미지 품질의 PNG 및 JPG 형식에 비해 파일 크기가 작은 것으로 검증되었습니다. 심지어 손실(lossy) 설정에서도 WebP는 원본과 거의 동일한 이미지를 생성할 수 있습니다. Android는 Android 4.0(API 수준 14: Ice Cream Sandwich) 이상에서 손실 WebP를 지원하고 Android 4.2(API 수준 17: Jelly Bean) 이상에서 무손실/투명 WebP를 지원합니다.
- 여러 밀도의 대형 이미지가 많이 있는 경우, 다중 APK 지원을 사용하여 APK를 밀도별로 분할해 보세요. 이 경우 특정 밀도를 대상으로 빌드되므로, 저밀도 기기를 가진 사용자는 사용하지 않는 고밀도 애셋의 다운로드에 관해 페널티를 받지 않습니다.
- APK 크기를 줄이는 방법에 관한 자세한 내용은 APK 크기 축소 및 코드 및 리소스 축소를 참고하세요. 또한 이 미디어 게시물 시리즈에서 APK 크기를 줄이는 방법에 관한 자세한 내용을 살펴볼 수 있습니다.
코드 크기 축소
- Android 프로젝트의 모든 라이브러리는 미사용될 가능성이 있는 코드를 APK에 추가합니다. 외부 라이브러리를 사용할 때 특히 주의해야 합니다. 모바일 앱에 사용하기 적합하지 않은 라이브러리도 있기 때문입니다. 앱이 사용 중인 라이브러리가 모바일 사용에 최적화되었는지 확인합니다.
- ProGuard와 같은 도구를 사용하여 컴파일한 코드를 최적화해 보세요. ProGuard는 사용하지 않는 코드를 식별하고 APK에서 삭제합니다. 또한
build.gradle
에서 minifyEnabled=true
, shrinkResources=true
를 설정하여 빌드 시간에 리소스 축소를 사용 설정합니다. 이 경우 미사용 리소스가 APK에서 자동으로 제거됩니다.
- Google Play 서비스를 사용 중인 경우에는 필요한 API만 APK에 선택적으로 포함해야 합니다.
- APK에서 코드 크기를 축소하는 자세한 방법은 Android 교육 과정에서 종속 항목 주입 프레임워크 피하기를 참고하세요.
외부(SD) 저장소로 앱을 이동하도록 허용
- 대개 저비용 기기에는 온디바이스 저장소가 거의 없습니다. 사용자가 SD 카드로 이러한 기기의 저장소를 확장할 수 있지만, 이 경우 사용자가 앱을 이동할 수 있으려면 외부 저장소에 앱 설치를 지원함을 명시적으로 선언해야 합니다.
- AndroidManifest.xml에서
android:installLocation
플래그를 사용하여 앱이 외부 저장소에 설치되도록 허용합니다. 앱을 외부 저장소로 이동할 수 있게 하는 자세한 방법은 앱 설치 위치에 관한 Android 가이드를 참고하세요.
설치 후 앱 디스크 사용량 축소
- 앱 디스크 사용량을 낮게 유지한다는 것은 기기의 빈 공간이 부족할 때 사용자가 여러분의 앱을 제거할 가능성이 적다는 것을 의미합니다. 중요한 점은 캐시 주변에 경계를 적용하는 것입니다. 이렇게 하면 앱 디스크 사용량이 무한히 늘어나지 않게 방지해 줍니다. 캐시된 데이터를 반드시
getCacheDir()
에 넣으세요. 필요한 경우에 시스템이 여기에 넣은 파일을 삭제하기 때문에 앱이 차지하는 저장용량으로 나타나지 않습니다.
구성 가능한 네트워크 사용량 제공
Android 플랫폼에는 사용자가 앱의 네트워크 사용을 제어하도록 권한을 부여하여 각자의 필요에 맞게 최적화할 수 있도록 하는 방법이 많습니다. 예를 들어 앱을 처음 사용할 때 사용자에게 다양한 네트워크 관련 설정을 안내할 수 있습니다.
앱 외부에서 네트워크 환경설정 화면을 제공할 수도 있습니다.
사용자의 네트워크 선택을 위한 온보딩 환경 제공
- 사용자가 데이터 사용량을 줄일 수 있도록 허용하는 앱은 데이터 요구사항이 높더라도 사용자가 잘 받아들입니다. 여러분의 앱이 상당한 크기의 대역폭을 사용하는 경우(예: 동영상 스트리밍 앱), 사용자가 네트워크 사용량을 구성하도록 온보딩 환경을 제공할 수 있습니다. 예를 들어, 사용자가 셀룰러 네트워크에서 비트 전송률이 낮은 동영상 스트림을 적용하도록 허용할 수 있습니다.
- 또한, 데이터 동기화, 미리 가져오기, 네트워크 사용 동작(예: 별표표시된 모든 뉴스 카테고리를 Wi-Fi에서만 미리 가져오기)을 사용자가 제어할 수 있도록 하는 추가적인 설정을 통해서도 사용자가 자신의 필요에 맞게 앱의 동작을 지정할 수 있습니다.
- 네트워크 사용량 관리에 관한 자세한 내용은 Android 교육 과정에서 네트워크 사용량 관리를 참고하세요.
네트워크 환경설정 화면 제공
- 네트워크 환경설정 화면을 통해 앱 외부에서 앱의 네트워크 설정을 탐색할 수 있습니다. 시스템 설정 화면이나 시스템 데이터 사용량 화면에서 이 화면을 호출할 수 있습니다.
- 사용자가 앱 내에서 또는 시스템 설정에서 액세스할 수 있는 네트워크 환경설정 화면을 제공하려면
ACTION_MANAGE_NETWORK_USAGE
작업을 지원하는 활동을 앱에 포함하세요.
- 네트워크 환경설정 화면의 추가에 관한 자세한 내용은 Android 교육 과정에서 환경설정 활동 구현을 참고하세요.
추가 리소스
이 주제에 관해 자세히 알아보려면 다음 추가 리소스를 참고하세요.
블로그 게시물
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Reduced data cost for billions\n\n\u003cbr /\u003e\n\n\nData plans in some countries can cost upwards of 10% of a typical user's monthly income. This\nmeans that minimizing your app's download size and letting the user control how your app uses\ndata can have a large, tangible benefit to many users. Minimizing download size also helps\nconserve space in internal storage, which is a scarce resource in some devices.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\nHere you can find some strategies to help optimize the amount of data your app uses, both over\nthe network and in internal storage.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nReduce app size\n---------------\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\nReducing app size is one of the fundamental ways you can help your user consume less data, in\nterms of both network data and internal storage. This section describes several approaches to\nreducing app size.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Reduce APK graphical asset size\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n- Graphical assets are often the largest contributor to the size of the APK. Optimizing these can result in smaller downloads and thus faster installation times for users.\n- For graphical assets such as icons, use the Scalable Vector Graphics (SVG) format. SVG images are tiny in size compared to bitmap graphics and can be rendered at runtime to any resolution. The [Android Support Library](/tools/support-library) provides a backward-compatible implementation for vector resources to Android 2.1 (API level 7). Get started with vectors with [this Medium post](https://medium.com/@chrisbanes/appcompat-v23-2-age-of-the-vectors-91cbafa87c88).\n- For non-vector images, such as photos, use [WebP](https://developers.google.com/speed/webp/) to reduce image load times and save network bandwidth. WebP is proven to result in smaller file sizes than its PNG and JPG counterparts, with at least the same image quality. Even at lossy settings, WebP can produce a nearly identical image to the original. Android has included lossy WebP support since Android 4.0 (API level 14: Ice Cream Sandwich) and support for lossless, transparent WebP since Android 4.2 (API level 17: Jelly Bean).\n- If you have many large images across multiple densities, consider using [Multiple\n APK support](/google/play/publishing/multiple-apks) to split your APK by density. This results in builds targeted for specific densities, meaning users with low-density devices won't have to incur the penalty of downloading unused high-density assets.\n- For more information about reducing APK size, see [Reduce APK Size](/topic/performance/reduce-apk-size) and [Shrink Your Code and Resources](/studio/build/shrink-code). In addition, you can find a detailed guide on reducing APK size in this [series of Medium posts](https://medium.com/@wkalicinski/smallerapk-part-4-multi-apk-through-abi-and-density-splits-477083989006).\n\n### Reduce code size\n\n- Every library in your Android project is adding potentially unused code to the APK. Be particularly careful about using external libraries because not all libraries are designed for use in mobile apps. Ensure that the libraries your app is using are optimized for mobile use.\n- Consider optimizing your compiled code using a tool such as [ProGuard](/tools/help/proguard). ProGuard identifies code that isn't being used and removes it from your APK. Also [enable resource shrinking](http://tools.android.com/tech-docs/new-build-system/resource-shrinking) at build time by setting `minifyEnabled=true`, `shrinkResources=true` in `build.gradle`---this automatically removes unused resources from your APK.\n- When using Google Play services, you should [selectively include](/google/play-services/setup#add_google_play_services_to_your_project) only the necessary APIs into your APK.\n- For more information on reducing code size in your APK, see the Android training on how to [Avoid\n dependency injection frameworks](/training/articles/memory#DependencyInjection).\n\n### Allow app to be moved to external (SD) storage\n\n- Low-cost devices often come with little on-device storage. Users can extend this with SD cards; however, apps need to explicitly declare that they support being installed to external storage before users can move them.\n- Allow your app to be installed to external storage using the [`\n android:installLocation`](/guide/topics/manifest/manifest-element#install) flag in your AndroidManifest.xml. For more information on enabling your app to be moved to external storage, see the Android guide on [App Install\n Location](/guide/topics/data/install-location).\n\n\u003cbr /\u003e\n\n### Reduce post-install app disk use\n\n\u003cbr /\u003e\n\n- Keeping your app's disk use low means that users are less likely to uninstall your app when the device is low on free space. It's important to apply bounds around your caches---this prevents your app's disk use from growing indefinitely. Be sure you put your cached data in [getCacheDir()](/reference/android/content/Context#getCacheDir())---the system can delete files placed here as needed, so they won't show up as storage committed to the app.\n\n\u003cbr /\u003e\n\nOffer configurable network use\n------------------------------\n\n\nThe Android platform includes a number of ways you can give the user control\nover your app's network use, optimizing it for their own needs. For example,\non first use, your app can walk the user through a variety of network-related settings.\nYou can also provide a network preferences screen from outside the app.\n\n### Provide onboarding experiences for users' network\nchoices\n\n\u003cbr /\u003e\n\n- Apps that allow users to reduce data use are well received, even if they have heavy data requirements. If your app uses a considerable amount of bandwidth (for example, video streaming apps), you can provide an onboarding experience for users to configure network use. For example, you could allow the user to force lower-bitrate video streams on cellular networks.\n- Additional settings for users to control data syncing, prefetching, and network use behavior (for example, prefetch all starred news categories on Wi-Fi only), also help users tailor your app's behavior to their needs.\n- For more information on managing network use, see the Android training on [Managing\n Network Usage](/training/basics/network-ops/managing).\n\n### Provide a network preferences\nscreen\n\n- You can navigate to the app's network settings from outside the app by means of a network preferences screen. You can invoke this screen from either the system settings screen or the system data usage screen.\n- To provide a network preferences screen that users can access from within your app as well as from the system settings, in your app include an activity that supports the [ACTION_MANAGE_NETWORK_USAGE](/reference/android/content/Intent#ACTION_MANAGE_NETWORK_USAGE) action.\n- For further information on adding a network preferences screen, see the Android training on [Implementing a Preferences Activity](/training/basics/network-ops/managing#prefs).\n\n\u003cbr /\u003e\n\nAdditional resources\n--------------------\n\nTo learn more about this topic, view the following additional resources:\n\n### Blog posts\n\n- [Nurture trust through cost transparency](https://medium.com/google-design/nurture-trust-through-cost-transparency-b61a5947d2fc)"]]