adb 명령어로 apk 파일 설치, 삭제 방법을 소개합니다.
adb install APK_FILE
다음 명령어는 PC에 있는 YouTube.apk파일을 디바이스에 설치합니다.
$ adb install YouTube.apk
Performing Streamed Install
Success디바이스에 있는 apk 설치
다음 명령어는 디바이스의 /data/local/tmp/YouTube.apk를 설치합니다.
$ adb shell pm install /data/local/tmp/YouTube.apk
Success이 명령어로 /sdcard/YouTube.apk의 파일을 설치하려고 하면 다음과 같이 권한 문제로 실패합니다.
$ adb shell pm install /sdcard/YouTube.apk
avc: denied { read } for scontext=u:r:system_server:s0 tcontext=u:object_r:fuse:s0 tclass=file permissive=0
System server has no access to read file context u:object_r:fuse:s0 (from path /sdcard/YouTube.apk, context u:r:system_server:s0)
Error: Unable to open file: /sdcard/YouTube.apk
Consider using a file under /data/local/tmp/
Error: Can't open file: /sdcard/YouTube.apk/data/local/tmp/ 경로 아래의 apk는 adb shell에서 접근 가능합니다.
디바이스에 저장된 apk를 설치하려면 /data/local/tmp로 apk를 이동시킨 뒤에 설치해야 합니다.
adb uninstall PACKAGE_NAME
다음 명령어는 디바이스에 설치된 패키지 com.google.android.youtube를 삭제합니다.
$ adb uninstall com.google.android.youtube
Success패키지 이름 확인
adb uninstall 명령어로 패키지를 삭제하려면 package name을 알고 있어야 합니다.
다음 명령어는 디바이스에 설치된 모든 패키지의 이름을 출력합니다. 앱 이름과 패키지 이름이 비슷하다면 여기서 찾아볼 수 있습니다.
$ adb shell pm list packages
package:com.google.android.networkstack.tethering
package:com.android.cts.priv.ctsshim
package:com.google.android.youtube
package:com.android.internal.display.cutout.emulation.corner
package:com.google.android.ext.services
package:com.android.internal.display.cutout.emulation.double
package:com.android.providers.telephony
package:com.android.dynsystem
package:com.android.theme.icon.pebble
...패키지 이름이 앱의 이름과 비슷하지 않다면, 위의 방법으로 패키지 이름을 찾기는 쉽지 않습니다.
이럴 때는 앱을 실행시키고, 아래와 같은 로그캣 명령어로 실행되는 앱의 Activity 이름으로 유사한 package name을 추측할 수 있습니다.
$ adb shell logcat -b events | grep wm_on_re
07-11 14:44:34.246 923 923 I wm_on_resume_called: [152199755,com.android.settings.FallbackHome,RESUME_ACTIVITY]
07-11 14:44:37.114 1045 1045 I wm_on_resume_called: [218164884,com.google.android.apps.nexuslauncher.NexusLauncherActivity,RESUME_ACTIVITY]
07-11 14:49:55.441 4941 4941 I wm_on_resume_called: [224219331,com.google.android.apps.youtube.app.WatchWhileActivity,RESUME_ACTIVITY]Loading script...
Related Posts
- Android 14 - 사진/동영상 파일, 일부 접근 권한 소개
- Android - adb push, pull로 파일 복사, 다운로드
- Android 14 - 암시적 인텐트 변경사항 및 문제 해결
- Jetpack Compose - Row와 Column
- Android 13, AOSP 오픈소스 다운로드 및 빌드
- Android 13 - 세분화된 미디어 파일 권한
- Android 13에서 Notification 권한 요청, 알림 띄우기
- Android 13에서 'Access blocked: ComponentInfo' 에러 해결
- 에러 해결: android gradle plugin requires java 11 to run. you are currently using java 1.8.
- 안드로이드 - 코루틴과 Retrofit으로 비동기 통신 예제
- 안드로이드 - 코루틴으로 URL 이미지 불러오기
- Android - 진동, Vibrator, VibrationEffect 예제
- Some problems were found with the configuration of task 에러 수정
- Query method parameters should either be a type that can be converted into a database column or a List
- 우분투에서 Android 12 오픈소스 다운로드 및 빌드
- Android - ViewModel을 생성하는 방법
- Android - Transformations.map(), switchMap() 차이점
- Android - Transformations.distinctUntilChanged() 소개
- Android - TabLayout 구현 방법 (+ ViewPager2)
- Android - 휴대폰 전화번호 가져오는 방법
- Android 12 - Splash Screens 알아보기
- Android 12 - Incremental Install (Play as you Download) 소개
- Android - adb 명령어로 bugreport 로그 파일 추출
- Android - adb 명령어로 App 데이터 삭제
- Android - adb 명령어로 앱 비활성화, 활성화
- Android - adb 명령어로 특정 패키지의 PID 찾기
- Android - adb 명령어로 퍼미션 Grant 또는 Revoke
- Android - adb 명령어로 apk 설치, 삭제
- Android - adb 명령어로 특정 패키지의 프로세스 종료
- Android - adb 명령어로 screen capture 저장
- Android - adb 명령어로 System 앱 삭제, 설치
- Android - adb 명령어로 settings value 확인, 변경
- Android 12 - IntentFilter의 exported 명시적 선언
- Android - adb 명령어로 공장초기화(Factory reset)
- Android - adb logcat 명령어로 로그 출력