35

Android 4.2 on tablets added support for multiple users per device (similar to desktop OSes), each of which can install and remove apps independently. Currently, using adb install /path/to/app.apk installs the app globally; every user can see and launch it (as if every user installed the same app from the Play store for example).

Is there a way to adb install an app onto a device so that only one user can see it in the launcher menu?

Forest Katsch
  • 1,485
  • 2
  • 15
  • 26
  • 1
    Android users, not computer users. Android tablets running >4.2 allow you to have multiple users on one device. I'd like to install my development apps to only one user instead of being installed for every user on the device. – Forest Katsch Dec 23 '13 at 15:34
  • 1
    @LokiSinclair : android allows to have several users on a device starting from 4.2. The question is to how to target a specific user when installing an application. – njzk2 Dec 23 '13 at 15:39
  • 7
    Please don't close vote due to unfamiliarity with the android multi-user functionality. The question is extremely clear and specific in the context of recent devices with this capability. – Chris Stratton Dec 23 '13 at 16:57

5 Answers5

24

adb install now supports --user USER_ID argument, so in order to install APK for a certain user, use:

adb install --user USER_ID PATH_TO_APK

In order to find out USER_ID, use adb shell pm list users.

See https://source.android.com/devices/tech/admin/multi-user-testing for details.

petrkotek
  • 4,541
  • 1
  • 18
  • 15
8

It may not have a per-user 'adb install', but it does have a per-user 'start' option when you want actual run the APK for testing. By default the documentation says 'start' will just start for the currently running user, but you can do

adb shell am start --user USER activity...

to start the APK as someone else. To get a list of users, run

adb shell pm list users
Xiao
  • 1,552
  • 2
  • 22
  • 20
Michael Galaxy
  • 1,213
  • 14
  • 17
8
pm enable [--user USER_ID] PACKAGE_OR_COMPONENT
pm disable [--user USER_ID] PACKAGE_OR_COMPONENT

pm enable --user 12 org.mozilla.firefox_beta

BuffK
  • 1,189
  • 14
  • 17
2

Here is the full documentation of the adb tool: http://developer.android.com/tools/help/adb.html adb install doesn't provide any way to specify the target users.

GareginSargsyan
  • 1,877
  • 15
  • 23
2

I stumbled across this post when I was having issues installing a React Native app on a phone with a separate Work Profile on it. For some reason, it felt like it was randomly choosing which profile to install the app on.

Here's what I did to specify the user manually:

  1. Build the app at least once:

    npx react-native run-android
    
  2. Uninstall if needed:

    adb uninstall <your package name here>
    
  3. Install the app manually. The APK path should be relative to the top level of your project:

    adb install --user 0 ./android/app/build/outputs/apk/debug/app-debug.apk
    
Chris Pavs
  • 85
  • 5