How to use `adb` to install development apps for one user only?

Viewed 17134

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?

5 Answers

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
    
Related