adb Verified current stable Not installed? Programming

Adb / Grant App Permission

Grant App Permission

Grants specified permissions to an application on the device.

$
Terminal
adb shell pm grant <package> <android.permission.CAMERA|android.permission.ACCESS_FINE_LOCATION|android.permission.READ_CONTACTS|...>

When To Use

When fine-tuning app capabilities or preparing for testing phases.

Pro Tip

Check compatibility of permissions; some may require elevated security clearance or user confirmation after granting.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
adb shell pm grant <package> <android.permission.CAMERA|android.permission.ACCESS_FINE_LOCATION|android.permission.READ_CONTACTS|...>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Package com.example.myapp granted permission android.permission.CAMERA
Package com.example.myapp granted permission android.permission.ACCESS_FINE_LOCATION

Anatomy of Output

Understanding the result

Success Grant Status

Indicates whether the permissions were successfully granted.

Granted permission: android.permission.ACCESS_FINE_LOCATION Granted Permission Notification

Confirms specific permissions granted to the application.

Total Permissions Granted: 3 Summary Count

Total number of permissions granted during operation.

Troubleshooting

Common pitfalls

adb shell pm grant: Package not found

Solution: Check if the package name is correct and ensure the app is installed.

adb shell pm grant: Permission <permission_name> is not a valid permission

Solution: Ensure the permission name is correctly spelled and applicable to the app.

adb shell pm grant: Operation not permitted

Solution: Check if your device has device-policy restrictions or required ROOT access.

Command Breakdown

What each part is doing

adb
Base Command
The executable that performs this operation. Here it runs Adb before the shell applies any redirect operators.
<package>
package
The value supplied for package.
<android.permission.CAMERA|android.permission.ACCESS_FINE_LOCATION|android.permission.READ_CONTACTS|...>
android.permission.CAMERA|android.permission.ACCESS FINE LOCATION|android.permission.READ CONTACTS|...
The value supplied for android.permission.CAMERA|android.permission.ACCESS FINE LOCATION|android.permission.READ CONTACTS|....

How To Run

Execution path

  1. Step 1

    Run the command: adb shell pm grant com.example.myapp android.permission.CAMERA

  2. Step 2

    Check the result using: adb shell pm list packages -f | grep com.example.myapp

  3. Step 3

    Verify permissions with: adb shell dumpsys package com.example.myapp | grep grantedPermissions

Alternative Approaches

Comparable commands in other tools

Alternative programming tools for the same job.