--------------------------------------------------------------------------------------------------------------- -------------
Xiao Kee : In the process of self-study, often need to get an APK package name, summed up a few ways to get the package name.
**********************
2014-10-29: First Edition
2014-10-30: Perfecting
**********************
--------------------------------------------------------------------------------------------------------------- ---------------
Our main use of course is the adb shell command.
Introduction of ADB Shell website:
1. Through the ADB shell into the phone data/data directory, view the package name (requires root)
ADB shell
CD Data/data
Ls
2. Check the package name via the ADB shell pm command (root not required)
adb shell pm List Package # will get the package name for all apk in the phone
For more commands, refer to the introduction of PM commands (HTTP://DEVELOPER.ANDROID.COM/TOOLS/HELP/ADB.HTML#PM):
For example I input, can clearly see the difference.
adb shell pm list package-f # will get the package name and path for all apk in the phone
3. View the package name by using the Dumpsys command of the ADB shell (root not required)
adb shell Dumpsys window W | findstr \ | findstr name= # you need to open the apk before typing the command
4. View the package name (no root required) by using Another command from the ADB Shell's Dumpsys
adb shell Dumpsys activity> c:\log.txt
# you need to open the apk before typing the command
After entering the command, there is no prompt in cmd, but in the C-drive directory, there will be one more Log.txt file.
Open a Log.txt file, search the Stack #1, and then look for cmp=.
You can see the package name and activity name.
5. View the package name by using grep (root not required)
adb Shell Logcat | grep START
# you need to open the apk before typing the command
View the bottom
Next, regardless of which apk,cmd command is opened, the package name and activity name are automatically displayed, for example, I opened the album again ~
You can see that the package name of the album is com.android.gallery3d,activity name is. app.gallery
6. View the package name (root not required) by using the AAPT tool that comes with it
Appt is the Android Asset packaging Tool, under the Build-tools directory of the SDK. The tool can view, create, update zip-format document attachments (Zip, jar, apk)
AAPT dump badging (apk path)
You can find the name of the package and activity, such as
Package name = Com.example.myfirstapp
Activity name = Com.example.myfirstap.MainAcitivity
7. View the package name (requires root and open view service) by using the hierayviewer tool that comes with it
# The apk must be opened first
8. use the Apktool tool to view the androidmanifest.xml file to get the package name (root required)
Apktool is the APK compilation tool provided by Google, capable of deserializing and compiling the APK, installing the Framework-res framework required by the anti-compilation system APK, and cleaning up the last anti-compilation folder. Java support is required.
someone here wrote a note about how to use it: Apktool's experience in use
But we only need two of these steps:
Apktool d <file.apk> <dir>#<file.apk> represents the path to the apk file to decompile, preferably with an absolute path, such as C:\apps\ myfirstapp.apk#<dir> represents the storage location of the post-compilation file, such as C:\apk\myfirstapp
1. Use Apktool to decompile app:apktool D c:\apps\myfirstapp.apk C:\apk\myfirstapp
2. Open Androidmanifest.xml
< Span style= "FONT-FAMILY:ARIAL,HELVETICA,SANS-SERIF;" > manifest node is the pack name of the APK:
/span> < Span style= "color: #000000;" >
android.intent.action.main and Android.intent.category.LAUNCHER corresponding to the activity, the activity corresponds to the android: The Name property is both the entry activity names.
android.intent.action.main represents the activity that the application started first
android.intent.category.launcher Indicates whether the application appears in the list of programs
9. Get the package name in code form
This is not much to describe, you can see the great God wrote: Get the package name of the installed app in the form of code
This is an online search, no attempt, interested can try.
ADB Shelllogcat | grep Android.intent.category.LAUNCHER
Android Automation Learning Note: Several ways to get the APK package name