【问题标题】:Error: Unknown admin: ComponentInfo错误:未知管理员:ComponentInfo
【发布时间】:2017-11-25 01:18:33
【问题描述】:

清单文件可以在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}

这是日志猫。

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

如何解决此问题以使应用程序成为设备所有者。

【问题讨论】:

    标签: android wso2 device-owner wso2iot dpm


    【解决方案1】:

    乍一看,您似乎缺少接收者名称中的“.services”,并且包名称不应包含“.services”。

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

    【讨论】:

      【解决方案2】:

      我知道它有点晚了,但我通过将 Manifest 文件中的接收器名称从 com.packageName.util.reciever.AdminReceiver 更改为 .AdminReceiver 解决了错误 - 然后直接将 Device Admin Receiver 放在包的根目录中

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

      【讨论】:

        【解决方案3】:

        已经很晚了,但对我来说解决的是在运行 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
        

        【讨论】:

        • 那你是怎么得到applicationId的?
        • @MartinR。你可以在你的 app build.gradle 文件中找到它。 android { defaultConfig { applicationId "hereIsYourApplicationId" } }
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-08-05
        • 2015-10-22
        • 1970-01-01
        • 2018-08-18
        • 2014-02-18
        相关资源
        最近更新 更多