How to Find appActivity and appPackage for Android App?

appActivity & appPackage are required to launch a Mobile App on Android device.

In Selenium, we use URL to launch a webpage. However in Appium, it is required to use Activity and Package details of an Android App to launch it on a Device.

Let’s have look at the steps to find out the Activity & Package Name for Android App:

NOTE: Assuming that Android Device is connected to your computer via USB cable and USB Debugging option of Android Device is also enabled.1. Launch the App that you want to test on Android Device2. Open command prompt and execute following command to make sure that Android Device is connected:

adb devices

3. Execute following 2 commands one by one to get App Activity and Package Name:

adb shell
dumpsys window windows | grep -E 'mCurrentFocus'

Once you get the appActivity & appPackage, then you need to set them in Desired Capabitites like below: