使我的应用成为设备所有者不起作用 [英] Making my app a device owner doesn't work

查看:380
本文介绍了使我的应用成为设备所有者不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要静默更新我的应用程序(如此处)。

I need to update my application silently (as described here).

所以我需要使我的应用成为手机SAMSUNG S6的设备所有者。我通过adb shell命令使用dpm命令,因此我配置了我的设备(从设置->帐户中删除所有帐户),启用开发人员模式,启用调试,像往常一样安装我的应用程序(例如与Android Studio一起安装),然后运行命令:

So I need to make my app a device owner in phone SAMSUNG S6. I use dpm command through adb shell command, so I provision my device (remove all account from Settings->Accounts), enable developer mode, enable debugging, install my app as usual (install it with Android Studio for example) and then run command:

adb shell dpm set-device-owner <PACKAGE-NAME>/.DeviceAdminComponent

但是我遇到下一个错误:

But I get a next error:

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:1701)
        at android.os.Parcel.readException(Parcel.java:1646)
        at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:6123)
        at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:148)
        at com.android.commands.dpm.Dpm.onRun(Dpm.java:96)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
        at com.android.commands.dpm.Dpm.main(Dpm.java:41)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:301)

这很奇怪。如果我运行此命令:

It's a very strange. If I run this command:

adb shell dpm set-profile-owner <PACKAGE-NAME>/.DeviceAdminComponent

对我来说很好。

有人可以帮我吗在这个问题上?也许是由于三星KNOX发生了? (我无法通过设备管理员-我的Knox策略管理员看到)。

Can somebody help me in this issue? Maybe it happens due to KNOX of SAMSUNG? (I see through Device Administrators - My Knox Policy Admin, that I can't disable).

推荐答案

要在手机上设置设备所有者的应用需要恢复出厂设置,那么您可以使用adb命令。

To set a device owner app on the phone requires a factory reset, then you can use adb command.

这篇关于使我的应用成为设备所有者不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆