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

前端 未结 4 2174
耶瑟儿~
耶瑟儿~ 2020-12-06 09:14

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

相关标签:
4条回答
  • 2020-12-06 09:44

    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.

    0 讨论(0)
  • 2020-12-06 09:57

    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.

    0 讨论(0)
  • 2020-12-06 09:59

    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
    
    0 讨论(0)
  • 2020-12-06 10:00
    pm enable [--user USER_ID] PACKAGE_OR_COMPONENT
    pm disable [--user USER_ID] PACKAGE_OR_COMPONENT
    

    pm enable --user 12 org.mozilla.firefox_beta

    0 讨论(0)
提交回复
热议问题