Reminder: adb install Needs -g To Auto-Grant Permissions

If your app has a targetSdkVersion of 23 or higher, and you are installing the app via the command line, note that adb install has two possible behaviors:

  • Used normally, the app is installed without any runtime permissions granted. This mimics a normal app install, where you have to ask for the permissions at runtime.

  • Use with the -g switch, the app is installed with all runtime permissions pre-granted, as if the app had a targetSdkVersion below 22. This can be handy for rapid testing, though it is not indicative of what the user will see.

(a hat tip to William Ferguson for pointing this out to me!)


Find out about new posts on the CommonsBlog via the Atom feed, or follow @CommonsWare on Twitter!