When we conduct automated mobile phone testing, we often need to know the package name and activity name of the app. Many colleagues don’t know where to find it when they first learn. In fact, there are many ways to obtain these values
The following is for the situation without source code, which is more suitable for beginners
Method one is to use the re-signature tool, which is used more in Robotium
The other method is to use the command line Get
Aapt dumpbadging xxxx.apk
The first box is the package name
The second box is the main Activity name
If To get the package name and activity in the command line, you can also use the following method to obtain them
Aapt dumpbadging xxxx.apk >c:\apk.txt
Then open c:\apk .txt
The third method, if you have installed Appium, you can do this
Enter the settings page, select the APK path, the package name and Activity name will be displayed below
The fourth method is to use hierarchyviewer to view
Aapt command
AAPT dump xmltree XXX.APK AndroidManifest.xm. >c.txt
Then go to C. TXT view
Type 6
Adbshell dumpsys activity activities >d:\log.txt
Then go to log.txt and search for package and Activity
The seventh method
Adb logcag >d:\3.txt
Then open the application on the phone
After opening it, press ctrl on the computer immediately +c
Then go to 3.txt to find PACKAGE and Activity