错误:未知管理员:组件信息


清单

文件可以在这里找到。

DeviceAdminReceiver 类可以在这里找到

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

我怎样才能解决这个问题,使应用程序成为设备所有者。

乍一看,接收方名称中似乎缺少".services",并且包名称不应包含".services"。

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

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

有点晚了,但我通过将清单文件中的接收器名称从 com.packageName.util.reciever.AdminReceiver 更改为 .AdminReceiver 来解决错误 - 然后直接将设备管理员接收器放在包的根目录中

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

我的包名称au.com.rightwayitservices.kiosk如清单文件中定义的那样,我的应用程序 ID 与 build.gradle 文件中一样au.com.rightwayitservices.kiosk,我的扩展 DeviceAdminReceiver 名称的类是 DeviceAdminReceiver

清单文件。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="au.com.rightwayitservices.kiosk" >
    <uses-feature
        android:name="android.hardware.telephony"
        android:required="false" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.REORDER_TASKS"/>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" tools:ignore="ProtectedPermissions"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="android.permission.PROCESS_INCOMING_CALLS"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">
        <activity
            android:name="au.com.rightwayitservices.kiosk.MainActivity"
            android:screenOrientation="portrait"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="au.com.rightwayitservices.kiosk.LockedActivity"
            android:label="@string/title_activity_locked"
            android:screenOrientation="portrait"
            android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.HOME"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <receiver
            android:name="au.com.rightwayitservices.kiosk.DeviceAdminReceiver"
            android:description="@string/app_name"
            android:label="@string/app_name"
            android:permission="android.permission.BIND_DEVICE_ADMIN">
            <meta-data
                android:name="android.app.device_admin"
                android:resource="@xml/device_admin_receiver" />
            <intent-filter>
                <action android:name="android.intent.action.DEVICE_ADMIN_ENABLED"/>
                <action android:name="android.app.action.DEVICE_ADMIN_DISABLED" />
                <action android:name="android.intent.action.PROFILE_PROVISIONING_COMPLETE"/>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>
    </application>
</manifest>

相关内容

  • 没有找到相关文章

最新更新