一、手機(jī)或模擬器上已安裝app(美團(tuán)為例)
- 方法一:在命令行輸入adb shell am monitor,按Enter,再啟動(dòng)想要獲取的app
(包名在最后一行:com.sankuai.meituan)
C:\Users\starteos>adb shell am monitor
Monitoring activity manager... available commands:
(q)uit: finish monitoring
** Activity starting: com.sankuai.meituan
- 方法二:先啟動(dòng)想要獲取的app,再輸入命令:adb shell dumpsys window w | findstr / | findstr name=,按Enter
(包名在倒數(shù)第二行)
C:\Users\starteos>adb shell dumpsys window w | findstr \/ | findstr name=
mSurface=Surface(name=GestureNavBottom)/@0x13b0c39
mSurface=Surface(name=GestureNavRight)/@0x1108b23
mSurface=Surface(name=GestureNavLeft)/@0x1108b89
mAnimationIsEntrance=true mSurface=Surface(name=StatusBar)/@0xcaf1d1
mSurface=Surface(name=PopupWindow:b18885b)/@0x11b9aa5
mSurface=Surface(name=com.sankuai.meituan/com.meituan.mmp.lib.mp.MPActivity0)/@0x1170be9
mAnimationIsEntrance=true mSurface=Surface(name=com.android.systemui.HwImageWallpaper)/@0x10b4741
- 方法三:先啟動(dòng)想要獲取的app,再輸入命令:adb shell dumpsys window | findstr mCurrentFocus,按Enter
(包名在中間)
C:\Users\starteos>adb shell dumpsys window | findstr mCurrentFocus
mCurrentFocus=Window{11b2959 u0 com.sankuai.meituan/com.meituan.mmp.lib.mp.MPActivity0}
- 方法四:獲取手機(jī)第三方所有應(yīng)用的包名,輸入命令:adb shell pm list package -3,按Enter
(包名在最后一行,每臺(tái)設(shè)備具體位置不同)
C:\Users\starteos>adb shell pm list package -3
package:io.appium.settings
package:com.smarttoolfactory.tutorial3_1transitions
package:com.sankuai.meituan
二、電腦上有apk安裝包
- 輸入命令:aapt dump badging + apk路徑
C:\Users\starteos>aapt dump badging D:\meituan_ui\app\imeituan.apk
package: name='com.sankuai.meituan' versionCode='1200020206' versionName='12.2.206' platformBuildVersionName='12.2.206' compileSdkVersion='29' compileSdkVersionCodename='10'
- 輸入命令:aapt dump xmltree + apk路徑 + AndroidManifest.xml | findstr “package”
C:\Users\starteos>aapt dump xmltree D:\meituan_ui\app\imeituan.apk AndroidManifest.xml | findstr "package"
A: package="com.sankuai.meituan" (Raw: "com.sankuai.meituan")
文章來源地址http://www.zghlxwxcb.cn/news/detail-509235.html
文章來源:http://www.zghlxwxcb.cn/news/detail-509235.html
到了這里,關(guān)于adb獲取app包名的方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!