Android 安卓 adb 获取app的包名和activity的几种方法
作者:侦探调查
时间:2024-05-02 18:35
获取app的包名和activity名称
(1)adb logcat | findstr START
然后点击app
CMD界面,cmp= 后面的值就是 包名/activity名称
例如: cmp=com.shanjian.originaldesign/.activity.other.Activity_In
(2)aapt dump badging D:\test\xxx.app
找到package: name=’com.shanjian.originaldesign’
再找launchable-activity: name=’com.shanjian.originaldesign.activity.other.Activity_In’
前提是在环境变量中–path路径下,设置了aapt的路径才能使用
(3)获取所有app的包名:adb shell pm list packages
(4)获取activity名:adb shell dumpsys activity activities >d:\log.txt
1)打开APP。
2)执行> adb logcat>D:/log.txt
3)胡乱的对APP做一些操作。
4) Ctrl+c 结束adb命令。
5)打开log.txt文件,搜索:Displayed
appPackage: com.android.messaging
appActivity:.ui.conversationlist.ConversationListActivity
6)打开logtxt文档然后找到:realActivity=com.android.deskclock/.DeskClock
adb -s 55K76DY995DYR4AY shell dumpsys activity activities >d:\789.txt
adb shell am start -n com.sg.netProxy/.MainActivity
C:\Users\86185>adb devices
List of devices attached
55K76DY995DYR4AY device
9H9PMNYT8D95Q4N7 device
EUU8WOXGLZ5HHYG6 device
KJ7LU4FUGMIRCMON device
MJ9DXKCINRTWDYSS device
OZBQONA6CYGQH6T8 device
QOOV5XI789IFBINN device
SGHIHAQGZ9NZPN9T device
XSQKCYAA55GMEARO device
C:\Users\86185>adb -s 55K76DY995DYR4AY shell dumpsys activity activities >d:\789.txt
C:\Users\86185>adb -s 55K76DY995DYR4AY shell activity activities >d:\789.txt
/system/bin/sh: activity: inaccessible or not found
C:\Users\86185>adb -s 55K76DY995DYR4AY shell activity activities >d:\log789.txt
/system/bin/sh: activity: inaccessible or not found
C:\Users\86185>adb -s 55K76DY995DYR4AY shell dumpsys activity activities >d:\logo789.txt
C:\Users\86185>adb shell am start -n com.sg.netProxy/.MainActivity