【发布时间】:2017-10-24 15:17:13
【问题描述】:
我正在关注此tutorial 将应用设置为设备所有者。在该教程中,有一节“使用 adb 设置设备所有者”。这里的教程说,安装 Kiosk Mode Demo App 后,运行以下命令:
adb shell dpm set-device-owner sdg.example.kiosk_mode/.AdminReceiver
这给了我错误:
adb server is out of date. killing...
* daemon started successfully *
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
at android.os.Parcel.readException(Parcel.java:1629)
at android.os.Parcel.readException(Parcel.java:1574)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:5146)
at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:114)
at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.dpm.Dpm.main(Dpm.java:38)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:257)
我关注了这个SO link,Diego Plascencia Lara 的回答帮助我摆脱了
adb server is out of date. killing...
* daemon started successfully *
但是运行adb shell dpm set-device-owner sdg.example.kiosk_mode/.AdminReceiver命令后还是出现如下错误:
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
at android.os.Parcel.readException(Parcel.java:1629)
at android.os.Parcel.readException(Parcel.java:1574)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:5146)
at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:114)
at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.dpm.Dpm.main(Dpm.java:38)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:257)
为什么会发生这个错误,我该如何消除它?我之前曾尝试将不同的应用程序设置为设备所有者,但我认为我没有设法将它们完全关闭,并且在完成让应用程序在设备上运行的整个过程时总是出现一些错误。
【问题讨论】:
标签: android adb device-owner