错误:未知的管理员:ComponentInfo

时间:2017-06-21 23:47:46

标签: android wso2 device-owner wso2iot dpm

可以找到清单文件here

可以找到DeviceAdminReceiver类here

agent_device_xml如下所示:

<?xml version="1.0" encoding="utf-8"?>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
    <limit-password />
    <watch-login />
    <reset-password />
    <force-lock />
    <wipe-data />
    <expire-password />
    <encrypted-storage />
    <disable-camera />
</uses-policies>

执行命令并出错:

adb shell dpm set-device-owner org.wso2.iot.agent.services/.AgentDeviceAdminReceiver
Error: Unknown admin: ComponentInfo{org.wso2.iot.agent.services/org.wso2.iot.agent.services.AgentDeviceAdminReceiver}

这是logcat。

06-21 13:58:54.053 11499-12787/org.wso2.iot.agent E/Volley: [714] NetworkDispatcher.run: Unhandled exception java.lang.SecurityException: Admin ComponentInfo{org.wso2.iot.agent/org.wso2.iot.agent.services.AgentDeviceAdminReceiver} does not own the device
                                                        java.lang.SecurityException: Admin ComponentInfo{org.wso2.iot.agent/org.wso2.iot.agent.services.AgentDeviceAdminReceiver} does not own the device
                                                            at android.os.Parcel.readException(Parcel.java:1689)
                                                            at android.os.Parcel.readException(Parcel.java:1641)
                                                            at android.app.admin.IDevicePolicyManager$Stub$Proxy.setAutoTimeRequired(IDevicePolicyManager.java:6759)
                                                            at android.app.admin.DevicePolicyManager.setAutoTimeRequired(DevicePolicyManager.java:3377)
                                                            at org.wso2.iot.agent.services.operation.OperationManagerDeviceOwner.setAutoTimeRequired(OperationManagerDeviceOwner.java:681)
                                                            at org.wso2.iot.agent.services.operation.OperationProcessor.doTask(OperationProcessor.java:219)
                                                            at org.wso2.iot.agent.services.operation.OperationProcessor.setPolicyBundle(OperationProcessor.java:267)
                                                            at org.wso2.iot.agent.services.operation.OperationProcessor.doTask(OperationProcessor.java:125)
                                                            at org.wso2.iot.agent.services.MessageProcessor.performOperation(MessageProcessor.java:130)
                                                            at org.wso2.iot.agent.services.MessageProcessor.onReceiveAPIResult(MessageProcessor.java:327)
                                                            at org.wso2.iot.agent.proxy.APIController$9.parseNetworkResponse(APIController.java:383)
                                                            at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:123)
06-21 13:58:54.054 11499-11499/org.wso2.iot.agent E/APIController: com.android.volley.VolleyError: java.lang.SecurityException: Admin ComponentInfo{org.wso2.iot.agent/org.wso2.iot.agent.services.AgentDeviceAdminReceiver} does not own the device

我如何解决这个问题,使应用程序成为设备所有者。

3 个答案:

答案 0 :(得分:4)

快速浏览一下,看起来你错过了收件人姓名中的“.services”,包名不应包含“.services”。

尝试: adb shell dpm set-device-owner org.wso2.iot.agent / .services.AgentDeviceAdminReceiver

答案 1 :(得分:1)

我有点晚了,但是我通过将清单文件中的接收方名称从com.packageName.util.reciever.AdminReceiver更改为.AdminReceiver来解决了该错误-然后将Device Admin Receiver直接放在包装

此后,安装该应用并从ADB运行命令,例如ADB shell dpm set-device-owner com.package.package/.AdminReceiver

答案 2 :(得分:1)

很晚了,但对我来说解决的是在运行 ADB 命令时更改 applicationId 的包名称。

我想做什么:

adb shell dpm set-device-owner com.package.name/com.package.name.MyDeviceAdminReceiver

什么有效:

adb shell dpm set-device-owner applicationId/com.package.name.MyDeviceAdminReceiver