ADB Tips for Appium: How to Locate Android Package and Activity Names Easily
Use ADB commands like adb shell dumpsys and adb shell pm list packages to find Android app package and activity names for Appium automation testing.

In mobile test automation, Appium is a widely used tool for testing Android and iOS applications. It helps testers automate actions on various devices and environments. A key part of setting up Appium tests is correctly identifying the package and activity names of the Android app you want to test. These names serve as unique identifiers, helping Appium locate and launch the application on the device. Without this information, Appium can’t access the app, making the automation setup incomplete.
This is where the Android Debug Bridge, or ADB, comes in as a powerful tool in mobile automation. ADB allows testers to communicate directly with Android devices, enabling essential actions like retrieving package and activity details, monitoring system logs, and more. By using ADB commands, we can easily extract the exact package and activity names needed for Appium automation, simplifying the setup process and enhancing testing accuracy.
📌Understanding Package and Activity Names
When working with Android applications, especially in the context of automation, understanding package and activity names is crucial. These two elements act as the key identifiers for any Android app, guiding tools like Appium to locate, launch, and interact with specific app components.
What is a Package Name?
The package name serves as a unique identifier for every Android application. It’s assigned when the app is created, usually following a reverse domain name format (e.g., com.example.myapp). This identifier differentiates one app from another, much like a unique address.
For example:
- In the Facebook app, the package name could be com.facebook.katana.
- For WhatsApp, it’s com.whatsapp.
The package name is essential because:
- It uniquely identifies an app on a device.
- It’s used by the Google Play Store to manage listings, permissions, and updates.
- It allows automation tools like Appium to target the correct app during testing.
What is an Activity Name?
An activity in Android is a screen or a component that allows user interaction. Each screen within an app is represented by an activity, and the activity name indicates which specific screen Appium should start with.
For instance, in a social media app, MainActivity might represent the home screen, while LoginActivity could be the login screen.
Activity names help Appium:
- Identify which screen to begin automation on.
- Bypass certain screens to start tests exactly where required.
- Simplify navigation and improve testing efficiency.
Example of Package and Activity Names in Appium
If we’re automating the login screen of a banking app with package com.bank.app and activity LoginActivity, we configure Appium like this:
Example code:

Here:
- appPackage tells Appium which app to open.
- appActivity directs Appium to start on the specified screen, optimizing the testing process.
How Package and Activity Names Help in Launching and Automating Apps Using Appium
In Appium, automation of Android apps requires specific “capabilities” to communicate with the app. Two of the most essential capabilities are the package name and activity name.
Importance of Package and Activity Names in Appium Automation
When automating an Android app, Appium requires information about the app’s location (package) and starting point (activity). Here’s how they help in launching and automating apps:
- Launching the App: Appium uses the package name and activity name to launch the app. These names are passed as capabilities in the Appium Desired Capabilities configuration, which guides Appium on which app to open and where to begin interacting. For example, if we want Appium to open the main screen of an app, we would specify the package name of the app along with the main activity name. Without these, Appium wouldn’t know which app or screen to interact with.
- Directing Appium to Specific Activities: Some apps require automation to begin on a different screen other than the main one, especially in cases like login screens or deep-linked pages. By specifying the package and a specific activity name, testers can guide Appium to launch right on that screen without needing to navigate through the entire app manually.
- Simplifying and Speeding Up Testing: Since Appium can start testing from a specified activity, testers save time by bypassing unnecessary screens. For example, if an app has an onboarding flow but the tests require only the dashboard screen, specifying the activity name of the dashboard as the starting point helps to skip onboarding, making tests more efficient and faster.
- Switching Between Activities: Some advanced automation flows require switching between different screens or sections of the app (activities). By configuring the package name and activity name, Appium can open new activities dynamically, allowing the tests to simulate real user journeys that go across multiple screens.
Click on this link to read more about it:
https://jignect.tech/adb-tips-for-appium-how-to-locate-android-package-and-activity-names-easily/
About the Creator
Jignect Technologies
At JigNect Technologies, we believe that software testing is an art, a science, and a passion. Our team of experts combines years of experience, cutting-edge technology.



Comments
There are no comments for this story
Be the first to respond and start the conversation.