adb 명령어로 특정 패키지의 PID 찾는 방법을 소개합니다.
1. adb shell pidof PACKAGE_NAME
다음 명령어는 com.google.android.youtube 패키지의 pid를 출력합니다. 5862이 Youtube의 PID입니다.
$ adb shell pidof com.google.android.youtube
5862App이 실행 중이 아니라면 PID가 없기 때문에, 아무것도 출력되지 않습니다.
2. adb shell ps -ef | grep PACKAGE_NAME
다음과 같이 쉘의 ps를 이용하여 특정 패키지의 PID를 찾을 수 있습니다. 5862가 Youtube의 PID입니다.
$ adb shell ps -ef | grep com.google.android.youtube
u0_a121 5862 291 18 15:03:08 ? 00:00:05 com.google.android.youtube3. 패키지 이름 확인
다음 명령어를 사용하면 디바이스에 설치된 모든 패키지의 리스트가 출력됩니다. 앱 이름과 패키지 이름이 비슷하다면 여기서 찾아볼 수 있습니다.
$ 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 명령어로 로그 출력