Ank*_*ham 11 android adb device-owner
我按照本教程将应用程序设置为设备所有者.在该教程中,有一节"使用adb设置设备所有者".这里的教程说明在安装Kiosk模式演示应用程序后,运行以下命令:
adb shell dpm set-device-owner sdg.example.kiosk_mode/.AdminReceiver
Run Code Online (Sandbox Code Playgroud)
这给了我错误:
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)
Run Code Online (Sandbox Code Playgroud)
我按照这个SO链接,Diego Plascencia Lara的答案帮助我摆脱了
adb server is out of date. killing...
* daemon started successfully *
Run Code Online (Sandbox Code Playgroud)
但运行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)
Run Code Online (Sandbox Code Playgroud)
为什么会发生此错误,如何删除?我之前曾尝试将不同的应用程序设置为设备所有者,但我认为我没有设法完全取消它们,并且在完成使应用程序在设备上运行的整个过程时总会出现一些错误.
Ank*_*ham 17
没有工厂重置设备,有一种解决这个问题的方法.只需从设备中删除所有帐户(在"设置" - >"帐户"中).您可能希望在执行此操作之前同步数据,以便以后可以还原它们.删除所有帐户后,将手机连接到计算机并运行命令:
adb shell dpm set-device-owner sdg.example.kiosk_mode/.AdminReceiver
如果你收到这样的消息:
Success: Device owner set to package ComponentInfo{org.bluetooth.bledemo/org.bluetooth.bledemo.AdminReceiver}
Active admin set to component {org.bluetooth.bledemo/org.bluetooth.bledemo.AdminReceiver}
Run Code Online (Sandbox Code Playgroud)
认为自己成功了.现在,您可以添加先前删除的所有帐户.
另一种方式:正如Steve Miskovetz在答案中所指出的,出厂重置是将应用设置为设备所有者的方法之一,如果之前,您的手机有帐户(例如Gmail帐户).但在Android和/或某些手机的最新版本中,在重置工厂后,除非您设置了Google帐户,否则他们不允许继续前进.因此,为了解决这个问题,请继续注册您的Google帐户,当您的手机恢复正常运行状态时,请通过设置 - >帐户删除该帐户.现在您只需要启用开发人员模式,然后启用USB调试.之后,将手机连接到计算机并运行命令adb shell dpm set-device-owner sdg.example.kiosk_mode/.AdminReceiver.
这篇文章对 dpm 命令进行了很好的概述:\n http://florent-dupont.blogspot.fr/2015/01/android-shell-command-dpm-device-policy.html
\n\n在帖子接近尾声时,添加了此更新:\n“设备所有者只能在未配置的设备上设置,除非它是由 \xe2\x80\x9cadb\xe2\x80\x9d 启动的,在这种情况下我们允许它如果没有帐户与设备关联\xe2\x80\x9d 则显示源代码。因此,在使用 dpm 命令之前,请确保\xe2\x80\x99t 没有与当前用户集关联的任何帐户(例如 Gmail) ”
\n\n我建议在执行出厂重置后,使用 dpm 以设备所有者身份安装和设置您的应用程序,在不设置任何帐户的情况下执行 Google 向导,从设置中启用开发人员模式,最后启用“USB 调试”...如果是这样对您来说可行的选择...
\n| 归档时间: |
|
| 查看次数: |
10949 次 |
| 最近记录: |