How to get Package name & Activity name of an android apk?
Properties of an apk file
Properties of an apk file provides valuable information of an apk file. With the help of “aapt” command we can get the information regarding an apk file.”aapt” command returns all the information comes from manifest file of apk.
Need of package and activity name of an apk file?
We need to provide package name and launchable activity name of android apk in test script under desired capabilities section to launch it in device or emulator.
Steps to find properties of an apk file:-
- Open command prompt
- Type below mentioned command aapt dump badging <apk file>ORaapt.exe dump badging <apk file>
D:\android-sdk-windows\build-tools22.0.1\aapt.exe dump badging C:UsersVikasDownloadsFlipkart.apk
- Press Enter button
If you have the Android SDK installed, you already have aapt. aapt stands for Android Asset Packaging Tool. It is a part of SDK. It is used to extract important data from an apk file.
Location of AAPT
In the SDK, aapt is found in the $ANDROID_HOME/build-tools/$Version/ directory of the SDK (where $ANDROID_HOME is the location of ANDROID SDK on your system and version is available version of build-tools on your system e.g. 22.0.1).
The ‘dump‘ sub-command of aapt is used to display the values of individual elements or parts of a package. It returns more fine grained data.
it prints details such as package name, version name, version code, permissions, supported screens, launcher Activity , application name and icon file and language support.