앱 설치 위치
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
API 수준 8부터 외부 저장소(예: 기기의 SD 카드)에 애플리케이션을 설치할 수 있습니다. 이는 android:installLocation
매니페스트 속성으로 애플리케이션에 관해 선언할 수 있는 선택적 기능입니다. 이 속성을 선언하지 않으면 애플리케이션이 내부 저장소에만 설치되며 외부 저장소로 이동할 수 없습니다.
시스템이 외부 저장소에 애플리케이션을 설치할 수 있게 하려면 매니페스트 파일을 수정하여 <manifest>
요소에 android:installLocation
속성을 포함합니다. 값은 'preferExternal
' 또는 'auto
'로 설정합니다. 예를 들면 다음과 같습니다.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal"
... >
'preferExternal
'을 선언하면 애플리케이션을 외부 저장소에 설치하도록 요청합니다. 그러나 시스템에서 반드시 애플리케이션을 외부 저장소에 설치한다는 보장은 없습니다. 외부 저장소가 가득 차면 시스템이 내부 저장소에 애플리케이션을 설치합니다. 또한 사용자는 두 위치 간에 애플리케이션을 이동할 수도 있습니다.
'auto
'를 선언하면 애플리케이션을 외부 저장소에 설치할 수 있지만 특별히 선호하는 설치 위치는 없다는 것을 나타냅니다. 시스템은 몇 가지 요인에 따라 애플리케이션을 설치할 위치를 결정합니다. 또한 사용자는 두 위치 간에 애플리케이션을 이동할 수도 있습니다.
애플리케이션이 외부 저장소에 설치되는 경우:
- 외부 저장소가 기기에 마운트되어 있는 동안 애플리케이션 성능에 미치는 영향은 없습니다.
.apk
파일은 외부 저장소에 저장되지만 모든 비공개 사용자 데이터, 데이터베이스, 최적화된 .dex
파일 및 추출된 네이티브 코드는 내부 기기 메모리에 저장됩니다.
- 애플리케이션이 저장되는 고유한 컨테이너는 무작위로 생성된 키로 암호화되며, 이 키는 원래 설치한 기기에서만 복호화할 수 있습니다. 따라서 SD 카드에 설치된 애플리케이션은 하나의 기기에서만 작동합니다.
- 사용자는 시스템 설정을 통해 애플리케이션을 내부 저장소로 이동할 수 있습니다.
경고: 사용자가 USB 대용량 저장소를 사용 설정하여 컴퓨터와 파일을 공유하거나 시스템 설정을 통해 SD 카드의 마운트를 해제하면 외부 저장소가 기기에서 마운트 해제되고 외부 저장소에서 실행 중인 모든 애플리케이션이 즉시 중단됩니다.
이전 버전과의 호환성
애플리케이션을 외부 저장소에 설치하는 기능은 API 수준 8(Android 2.2) 이상을 실행하는 기기에서만 제공되는 기능입니다. API 수준 8 이전에 빌드된 기존 애플리케이션은 항상 내부 저장소에 설치되고 외부 저장소로 이동할 수 없습니다(API 수준 8 기기에서도 불가). 그러나 애플리케이션이 API 수준 8 미만을 지원하도록 설계된 경우 API 수준 8 이상 기기에서 이 기능을 지원하도록 선택할 수 있으며 API 수준 8 미만을 사용하는 기기와도 계속 호환됩니다.
외부 저장소 설치를 허용하고 API 수준 8 미만 버전과의 호환성을 유지하는 방법은 다음과 같습니다.
<manifest>
요소에 값을 'auto
' 또는 'preferExternal
'로 설정한 android:installLocation
속성을 포함합니다.
android:minSdkVersion
속성을 그대로 두고(예: '8' 미만) 애플리케이션 코드가 이 수준과 호환되는 API만 사용하는지 확인합니다.
- 애플리케이션을 컴파일하려면 빌드 타겟을 API 수준 8로 변경합니다. 이전의 Android 라이브러리는
android:installLocation
속성을 인식하지 못하므로 이 속성이 있을 경우 애플리케이션을 컴파일하지 않기 때문에 이러한 변경이 필요합니다.
애플리케이션이 API 수준 8 이만의 기기에 설치되어 있을 때 android:installLocation
속성은 무시되고 애플리케이션이 내부 저장소에 설치됩니다.
주의: 이 같은 XML 마크업이 이전 버전의 플랫폼에서는 무시되지만 코드에서 이전 버전과의 호환성을 제공하는 데 필요한 작업을 하지 않는 한, minSdkVersion
이 '8' 미만일 때는 API 수준 8에 도입된 프로그래밍 API를 사용하지 않도록 주의해야 합니다.
외부 저장소에 설치해서는 안 되는 애플리케이션
사용자가 USB 대용량 저장소를 사용 설정하여 컴퓨터와 파일을 공유하면(또는 다른 방법으로 외부 저장소를 마운트 해제하거나 제거하면) 외부 저장소에 설치되어 현재 실행 중인 모든 애플리케이션이 중단됩니다. 대용량 저장소를 사용 중지하고 외부 저장소를 기기에 다시 마운트할 때까지 시스템은 사실상 애플리케이션을 인식하지 못하게 됩니다. 애플리케이션이 종료되어 사용자가 이를 사용할 수 없게 될 뿐만 아니라 일부 유형의 애플리케이션은 더 심각한 방식으로 중단될 수 있습니다. 애플리케이션이 예상대로 일관되게 작동하게 하려면 애플리케이션이 외부 저장소에 설치되도록 허용해서는 안 됩니다. 애플리케이션이 다음과 같은 기능을 사용할 경우 외부 저장소가 마운트 해제될 때 위와 같은 결과가 발생할 수 있기 때문입니다.
- 서비스
- 실행 중인
Service
가 중단되고 외부 저장소가 다시 마운트될 때 다시 시작되지 않습니다. 이 서비스에 결합된 애플리케이션은 ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
브로드캐스트 인텐트에 등록할 수 있습니다. 이 브로드캐스트 인텐트는 외부 저장소에 설치된 애플리케이션을 시스템에서 다시 사용할 수 있게 되었을 때 외부 저장소에 설치되지 않은 모든 애플리케이션에 알립니다. 이 브로드캐스트를 수신한 후 애플리케이션은 서비스에 결합을 시도할 수 있습니다.
- 알람 서비스
AlarmManager
로 등록된 알람이 취소됩니다. 외부 저장소가 다시 마운트되면 알람을 수동으로 다시 등록해야 합니다.
- IME(Input Method Engine)
- IME가 기본 IME로 대체됩니다. 외부 저장소가 다시 마운트되면 사용자는 시스템 설정을 열어 IME를 다시 사용 설정할 수 있습니다.
- 라이브 배경화면
- 실행 중인 라이브 배경화면이 기본 라이브 배경화면으로 대체됩니다. 외부 저장소가 다시 마운트되면 사용자는 라이브 배경화면을 다시 선택할 수 있습니다.
- 앱 위젯
- 앱 위젯이 홈 화면에서 삭제됩니다. 외부 저장소가 다시 마운트된 이후 시스템이 홈 애플리케이션을 재설정할 때까지(일반적으로 시스템을 재부팅하기 전까지) 사용자가 앱 위젯을 선택할 수 없습니다.
- 계정 관리자
AccountManager
로 생성된 계정은 외부 저장소가 다시 마운트될 때까지 사라집니다.- 동기화 어댑터
AbstractThreadedSyncAdapter
및 모든 동기화 기능은 외부 저장소가 다시 마운트될 때까지 작동하지 않습니다.- 기기 관리자
DeviceAdminReceiver
및 모든 관리 기능이 사용 중지되어 기기 기능에 예측하지 못한 결과가 초래될 수 있으며 외부 저장소가 다시 마운트된 이후에도 그 영향이 지속될 수 있습니다.- '부팅 완료'를 수신 대기하는 broadcast receiver
- 외부 저장소가 기기에 마운트되기 전에 시스템이
ACTION_BOOT_COMPLETED
브로드캐스트를 전송합니다. 애플리케이션이 외부 저장소에 설치되어 있으면 이 브로드캐스트를 절대 수신할 수 없습니다.
애플리케이션이 위에 나열된 기능 중 하나라도 사용한다면 애플리케이션을 외부 저장소에 설치하도록 허용해서는 안 됩니다. 기본적으로 시스템은 애플리케이션을 외부 저장소에 설치하도록 허용하지 않으므로 기존 애플리케이션에 관해서는 염려할 필요가 없습니다. 그러나 애플리케이션을 외부 저장소에 설치해서는 안 된다는 확신이 있다면 값을 'internalOnly
'로 설정한 android:installLocation
을 선언하여 이를 명확히 지정해야 합니다. 이 선언은 기본 동작을 변경하지는 않지만 애플리케이션을 내부 저장소에만 설치해야 한다는 것을 명시적으로 지정하고, 개발자 본인과 다른 개발자에게 이러한 결정을 내렸음을 알리는 역할을 합니다.
외부 저장소에 설치해야 하는 애플리케이션
간단히 말하면, 이전 섹션에 나열된 기능을 사용하지 않는 모든 것은 외부 저장소에 설치해도 안전합니다. 외부 저장소에 설치를 허용해야 하는 일반적인 애플리케이션 유형으로는 대용량 게임이 있습니다. 게임은 대개 비활성화 상태에서 추가적인 서비스를 제공하지 않기 때문입니다. 외부 저장소를 사용할 수 없게 되어 게임 프로세스가 중단된 경우 저장소를 다시 사용할 수 있게 되어 사용자가 게임을 다시 시작했을 때 눈에 띄는 영향이 없어야 합니다(게임이 정상 활동 수명 주기 동안 상태를 적절히 저장했다고 가정할 경우).
애플리케이션에서 APK 파일에 몇 MB가 필요한 경우 사용자가 내부 저장소의 공간을 절약할 수 있도록 애플리케이션을 외부 저장소에 설치할 수 있게 할지 여부를 신중하게 고려해야 합니다.
추가 관련 정보는 <manifest>를 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(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"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# App install location\n\nBeginning with API Level 8, you can allow your application to be installed on the\nexternal storage (for example, the device's SD card). This is an optional feature you can declare\nfor your application with the [`android:installLocation`](/guide/topics/manifest/manifest-element#install) manifest attribute. If you do\n*not* declare this attribute, your application will be installed on the internal storage\nonly and it cannot be moved to the external storage.\n\nTo allow the system to install your application on the external storage, modify your\nmanifest file to include the [`android:installLocation`](/guide/topics/manifest/manifest-element#install) attribute in the [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element) element,\nwith a value of either \"`preferExternal`\" or \"`auto`\". For example: \n\n```xml\n\u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:installLocation=\"preferExternal\"\n ... \u003e\n```\n\nIf you declare \"`preferExternal`\", you request that your application be installed on the\nexternal storage, but the system does not guarantee that your application will be installed on\nthe external storage. If the external storage is full, the system will install it on the internal\nstorage. The user can also move your application between the two locations.\n\nIf you declare \"`auto`\", you indicate that your application may be installed on the\nexternal storage, but you don't have a preference of install location. The system will\ndecide where to install your application based on several factors. The user can also move your\napplication between the two locations.\n\nWhen your application is installed on the external storage:\n\n- There is no effect on the application performance so long as the external storage is mounted on the device.\n- The `.apk` file is saved on the external storage, but all private user data, databases, optimized `.dex` files, and extracted native code are saved on the internal device memory.\n- The unique container in which your application is stored is encrypted with a randomly generated key that can be decrypted only by the device that originally installed it. Thus, an application installed on an SD card works for only one device.\n- The user can move your application to the internal storage through the system settings.\n\n**Warning:** When the user enables USB mass storage to share files\nwith a computer or unmounts the SD card via the system settings, the external storage is unmounted\nfrom the device and all applications running on the external storage are immediately killed.\n\nBackward compatibility\n----------------------\n\nThe ability for your application to install on the external storage is a feature available only\non devices running API Level 8 (Android 2.2) or greater. Existing applications that were built prior\nto API Level 8 will always install on the internal storage and cannot be moved to the external\nstorage (even on devices with API Level 8). However, if your application is designed to support an\nAPI Level *lower than* 8, you can choose to support this feature for devices with API Level 8\nor greater and still be compatible with devices using an API Level lower than 8.\n\nTo allow installation on external storage and remain compatible with versions lower than API\nLevel 8:\n\n1. Include the `android:installLocation` attribute with a value of \"`auto`\" or \"`preferExternal`\" in the [\u003cmanifest\u003e](/guide/topics/manifest/uses-sdk-element) element.\n2. Leave your `android:minSdkVersion` attribute as is (something *less\n than* \"8\") and be certain that your application code uses only APIs compatible with that level.\n3. In order to compile your application, change your build target to API Level 8. This is necessary because older Android libraries don't understand the `android:installLocation` attribute and will not compile your application when it's present.\n\nWhen your application is installed on a device with an API Level lower than 8, the `android:installLocation` attribute is ignored and the application is installed on the internal\nstorage.\n\n**Caution:** Although XML markup such as this will be ignored by\nolder platforms, you must be careful not to use programming APIs introduced in API Level 8\nwhile your `minSdkVersion` is less than \"8\", unless you perform the work necessary to\nprovide backward compatibility in your code.\n\nApplications that should NOT install on external storage\n--------------------------------------------------------\n\nWhen the user enables USB mass storage to share files with their computer (or otherwise\nunmounts or removes the external storage), any application\ninstalled on the external storage and currently running is killed. The system effectively becomes\nunaware of the application until mass storage is disabled and the external storage is\nremounted on the device. Besides killing the application and making it unavailable to the user,\nthis can break some types of applications in a more serious way. In order for your application to\nconsistently behave as expected, you **should not** allow your application to be\ninstalled on the external storage if it uses any of the following features, due to the cited\nconsequences when the external storage is unmounted:\n\nServices\n: Your running\n [Service](/reference/android/app/Service) is\n killed and isn't restarted when external storage is remounted. Applications\n bound to this service can register for the\n [ACTION_EXTERNAL_APPLICATIONS_AVAILABLE](/reference/android/content/Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE)\n broadcast intent, which notifies all applications that *aren't*\n installed on external storage when the applications installed on external\n storage have become available to the system again. After receiving this\n broadcast, applications can attempt to bind to your service.\n\nAlarm Services\n: Your alarms registered with [AlarmManager](/reference/android/app/AlarmManager) will be cancelled. You must\n manually re-register any alarms when external storage is remounted.\n\nInput Method Engines\n: Your [IME](/guide/topics/text/creating-input-method) will be\n replaced by the default IME. When external storage is remounted, the user can open system settings\n to enable your IME again.\n\nLive Wallpapers\n: Your running [Live Wallpaper](http://android-developers.blogspot.com/2010/02/live-wallpapers.html)\n will be replaced by the default Live Wallpaper. When external storage is remounted, the user can\n select your Live Wallpaper again.\n\nApp Widgets\n: Your [App Widget](/guide/topics/appwidgets) will be removed\n from the home screen. When external storage is remounted, your App Widget will *not* be\n available for the user to select until the system resets the home application (usually not until a\n system reboot).\n\nAccount Managers\n: Your accounts created with [AccountManager](/reference/android/accounts/AccountManager) will disappear until\n external storage is remounted.\n\nSync Adapters\n: Your [AbstractThreadedSyncAdapter](/reference/android/content/AbstractThreadedSyncAdapter) and all its sync functionality will\n not work until external storage is remounted.\n\nDevice Administrators\n: Your [DeviceAdminReceiver](/reference/android/app/admin/DeviceAdminReceiver) and all its admin capabilities will\n be disabled, which can have unforeseeable consequences for the device functionality, which may\n persist after external storage is remounted.\n\nBroadcast Receivers listening for \"boot completed\"\n: The system delivers the [ACTION_BOOT_COMPLETED](/reference/android/content/Intent#ACTION_BOOT_COMPLETED) broadcast\n before the external storage is mounted to the device. If your application is installed on the\n external storage, it can never receive this broadcast.\n\nIf your application uses any of the features listed above, you **should not** allow\nyour application to install on external storage. By default, the system *will not* allow your\napplication to install on the external storage, so you don't need to worry about your existing\napplications. However, if you're certain that your application should never be installed on the\nexternal storage, then you should make this clear by declaring [`android:installLocation`](/guide/topics/manifest/manifest-element#install) with a value of \"`internalOnly`\". Though this does not\nchange the default behavior, it explicitly states that your application should only be installed\non the internal storage and serves as a reminder to you and other developers that this decision has\nbeen made.\n\nApplications that should install on external storage\n----------------------------------------------------\n\nIn simple terms, anything that does not use the features listed in the previous section\nare safe when installed on external storage. Large games are more commonly the types of\napplications that should allow installation on external storage, because games don't typically\nprovide additional services when inactive. When external storage becomes unavailable and a game\nprocess is killed, there should be no visible effect when the storage becomes available again and\nthe user restarts the game (assuming that the game properly saved its state during the normal\n[Activity lifecycle](/guide/components/activities#Lifecycle)).\n\nIf your application requires several megabytes for the APK file, you should\ncarefully consider whether to enable the application to install on the external storage so that\nusers can preserve space on their internal storage.\n\nFor additional related information, refer to:[\\\u003cmanifest\\\u003e](/guide/topics/manifest/manifest-element)"]]