Question: I have an apk file. 
Now i need to fetch package-name as well as launcher activity from apk so that i can install apk and launch app from my test cases.

Answer: 
You can take a look at [link](http://qahumor.blogspot.in/2015/06/appium-how-to-get-package-name-of.html)

There are multiple ways in which we can obtain the package name of Android .apk file. 
Here are the some quick ways to get the package name.

**Step 1** : If its public app and available in <https://play.google.com/store/apps> , then search the app name and click on that particular app. you will get the package name as shown in below screenshot.
[![enter image description here](https://i.stack.imgur.com/oiErY.jpg)](https://i.stack.imgur.com/oiErY.jpg)

Step 2 : Install the app on your device and run the below command to get the list of packages and search for your app. 
 \*(Make sure ADB configured in your path variable, [click here to know how to configure adb](http://qahumor.blogspot.in/2015/06/appium-setting-up-environment-for.html))

-> adb shell pm list packages
[![enter image description here](https://i.stack.imgur.com/BLz33.jpg)](https://i.stack.imgur.com/BLz33.jpg) 

Now the Step 3, where you can get the package name as well as launcher activity name - [link](http://qahumor.blogspot.in/2015/06/appium-how-to-get-package-name-of.html)

Step 3 : using the aapt command.

To get the aapt.exe , you have to navigate to android sdk folder then build-tools and goto some api version . for example(specific to my machine) 
E:\Android\adt\sdk\build-tools\android-4.4W 

open command prompt and run the below command 
- aapt dump badging

for example : Let's take whatsapp application
- aapt dump badging E:\com.whatsapp.apk

output :
You can get the package name and launchable-activity with other details as highlighted in below :
[![enter image description here](https://i.stack.imgur.com/a0pN3.jpg)](https://i.stack.imgur.com/a0pN3.jpg)
You can also use the following steps:

1. Connect device to your computer
2. Open any IDE Android studio or eclipse
3. Look at the logs of the device
4. Filter the logs by using your app name
5. open the app on your device and you would be able to see package name and launcher activity in the logs.