How to List Permissions of an Android Application via ADB

How to List Permissions of an Android Application via ADB

30 November 2024 Stephan Petzl Leave a comment Tech-Help

Managing permissions for Android applications is a crucial aspect of app development and testing. Knowing which permissions are granted and which are merely requested can be essential for debugging and ensuring that your application functions correctly across different devices. Here’s a comprehensive guide on how to list permissions for an Android application using ADB (Android Debug Bridge).

Understanding Permissions with ADB

ADB provides several ways to inspect the permissions of an application. Below, we explore different methods to achieve this, ensuring you can choose the one that best suits your needs.

1. Listing Granted Permissions

To view only the permissions that have been granted to an application, you can use the following ADB command:

adb shell dumpsys package <i>packagename</i>

Inspect the grantedPermissions section at the bottom of the output to see permissions that have been granted.

2. Listing All Requested Permissions

To list all permissions (both granted and requested but not granted), you can follow these steps:

  • Find the APK path of the desired package using the command:
adb shell dumpsys package <i>packagename</i>
  • Pull the APK from the device if necessary:
  • adb pull /data/app/com.your.package.apk
  • Use the aapt tool to list permissions:
  • aapt d permissions /path/to/com.your.package.apk

    Note: The aapt tool can be found under build-tools/<version>/ in your Android SDK.

    3. Quick Permission Check

    For a quick overview of permissions, you can use:

    adb shell dumpsys package <i>packagename</i> | grep permission

    This command provides a fast way to see permissions, though it may not list all possible permissions.

    Advanced Permission Management

    For a more detailed analysis, especially if you are dealing with default Android permissions and user-level permissions, consider using:

    • adb shell pm list permissions to list permissions available on the system.
    • adb shell cmd appops get <package> to list permissions at the user level.

    Enhancing Your Testing Workflow with Repeato

    While manually managing permissions is possible, automating this process can save time and reduce errors. Our product, Repeato, offers a no-code solution for test automation on iOS and Android. It integrates seamlessly with ADB, allowing you to execute ADB commands through script steps. This capability ensures precise control over permissions and other device configurations during automated test runs. By leveraging computer vision and AI, Repeato makes the process of creating, running, and maintaining tests fast and efficient.

    For more detailed information on setting up virtual test devices and advanced testing techniques, visit our documentation.

    Like this article? there’s more where that came from!