1. 查看所有应用的包名: $ adb shell pm list packages -f
$ adb shell
$ pm list packages -f
package:/data/app/com.coloros.backuprestore-2/base.apk=com.coloros.backuprestore
package:/data/app/com.github.uiautomator-1/base.apk=com.github.uiautomator
package:/system/app/LogKitSdService/LogKitSdService.apk=com.oppo.logkitsdservice
package:/system/app/CTAutoRegist/CTAutoRegist.apk=com.oppo.ctautoregist
package:/system/app/PhoneNOAreaInquireProvider/PhoneNOAreaInquireProvider.apk=com.coloros.phonenoareainquire
package:/system/priv-app/TelephonyProvider/TelephonyProvider.apk=com.android.providers.telephony
package:/data/app/io.appium.settings-1/base.apk=io.appium.settings
package:/system/priv-app/OppoWirelessSettings/OppoWirelessSettings.apk=com.coloros.wirelesssettings
package:/data/app/com.tencent.qmdebugmodeopenner-1/base.apk=com.tencent.qmdebugmodeopenner
package:/system/app/GnssPowerSaver/GnssPowerSaver.apk=com.gnss.power
package:/system/priv-app/CalendarProvider/CalendarProvider.apk=com.android.providers.calendar
package:/system/priv-app/MediaProvider/MediaProvider.apk=com.android.providers.media
package:/system/app/OppoFreeFallingMonitor/OppoFreeFallingMonitor.apk=com.oppo.freefallingmonitor
package:/system/vendor/app/colorservice/colorservice.apk=com.qti.service.colorservice
package:/data/app/com.qiyi.video-2/base.apk=com.qiyi.video
package:/system/app/SystemHelper/SystemHelper.apk=com.mobiletools.systemhelper
package:/system/app/WifiRxSensTest/WifiRxSensTest.apk=com.wifi.rxsenstest
package:/system/app/ModemTestMode/ModemTestMode.apk=com.qualcomm.qti.modemtestmode
package:/system/app/shutdownlistener/shutdownlistener.apk=com.qualcomm.shutdownlistner
package:/data/app/com.sohu.inputmethod.sogou-1/base.apk=com.sohu.inputmethod.sogou
package:/system/priv-app/WallpaperCropper/WallpaperCropper.apk=com.android.wallpapercropper
2. 查看非系统安装的包名:$ adb shell pm list packages -3
$ adb shell
$ pm list packages -3
package:com.github.uiautomator
package:io.appium.settings
package:com.tencent.qmdebugmodeopenner
package:com.qiyi.video
package:com.sohu.inputmethod.sogou
package:com.sankuai.meituan
package:com.nearme.note
package:com.tencent.liteav.demo
package:com.tencent.FileManager
package:com.huiian.timing
package:com.github.uiautomator.test
package:com.sunlands.marketing
package:com.sunlands.sdjg.lite
package:org.hapjs.debugger
package:com.netease.nie.yosemite
package:com.tencent.mm
package:com.tencent.android.qqdownloader
package:jp.co.cyberagent.stf.rotationwatcher
package:com.baidu.searchbox
3. 查看包含指定信息的包名:$ grep ×××
$ adb shell
$ pm list packages -3 | grep qq
package:com.tencent.android.qqdownloader
package:com.tencent.mobileqq
4. 查看指定打开的包名
$ adb shell monkey --port 1080 -v
待出现:IncludeCategory: android.intent.category.MONKEY后
点击手机上的应用,命令提示符中,便会出现相应的包名
$ adb shell
$ monkey --port 1080 -v
:Monkey: seed=1556117080898 count=1000
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.oppo.book/com.qq.reader.activity.SplashActivity bnds=[24,644][192,840] } in package com.oppo.book
5. 查看当前打开的包名:$ adb shell dumpsys window |grep mCurrent
$ adb shell
$ dumpsys window |grep mCurrent
mCurrentAppOrientation=1
mCurrentRotation=0
mCurrentUserId=0
mCurrentFocus=Window{9e73ac7 u0 com.tencent.mm/com.tencent.mm.ui.LauncherUI}
网友评论