Search code examples
androidpermissionsadbrobotium

Android grant permission error


I got this error when i was going to grant CHANGE_CONFIGURATION permission to my application:(is Windows platform)

CMD command line error is below:

/$ pm grant packageName android.permission.CHANGE_CONFIGURATION >

operation not allowed: java.lang.SecurityException: Package packageName has not requested permission android.permission.CHANGE_CONFIGURATION

Anyone know how to solve this?

Thanks


Solution

  • Have you requested CHANGE_CONFIGURATION in your Manifest?

    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION">    
    

    Which device and version of Android are you using? I've tested the pm grant command on a Nexus 6 using Android 6 (MRA58N), it worked.