[liy@Arch-inLe platform-tools]$ ./adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
GMUY889898223888 unauthorized
[liy@Arch-inLe platform-tools]$ ./adb devices
List of devices attached
GMUY889898223888 device
[liy@liArch-inLe platform-tools]$ ./adb shell sh /storage/emulated/0/Android/data/moe.shizuku.privileged.api/start.sh
info: start.sh begin
info: attempt to copy starter from /storage/emulated/0/Android/data/moe.shizuku.privileged.api/starter to /data/local/tmp/shizuku_starter
info: exec /data/local/tmp/shizuku_starter
info: starter begin
info: killing old process...
info: apk path is /data/app/~~PIIJFfJDXgUM5XlLnrHToQ==/moe.shizuku.privileged.api-YHr4Rf4TkSVNWmNzxHCiiw==/base.apk
info: starting server...
info: shizuku_starter exit with 0
[liy@liArch-inLe platform-tools]$ ./adb shell dpm set-device-owner com.rosan.dhizuku/.server.DhizukuDAReceiver
Success: Device owner set to package com.rosan.dhizuku/.server.DhizukuDAReceiver
Active admin set to component com.rosan.dhizuku/.server.DhizukuDAReceiver
[liy@liArch-inLe platform-tools]$ ./adb shell dpm set-device-owner com.rosan.dhizuku/.server.DhizukuDAReceiver
Exception occurred while executing 'set-device-owner':
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device.
at com.android.server.devicepolicy.DevicePolicyManagerService.enforceCanSetDeviceOwnerLocked(DevicePolicyManagerService.java:9645) at com.android.server.devicepolicy.DevicePolicyManagerService.setDeviceOwner(DevicePolicyManagerService.java:8568) at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.runSetDeviceOwner(DevicePolicyManagerServiceShellCommand.java:256) at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.onCommand(DevicePolicyManagerServiceShellCommand.java:89) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.server.devicepolicy.DevicePolicyManagerService.onShellCommand(DevicePolicyManagerService.java:9967) at android.os.Binder.shellCommand(Binder.java:962) at android.os.Binder.onTransact(Binder.java:846) at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:6966) at com.android.server.devicepolicy.DevicePolicyManagerService.onTransact(DevicePolicyManagerService.java:17958) at android.os.Binder.execTransactInternal(Binder.java:1197) at android.os.Binder.execTransact(Binder.java:1156)
表示手机系统存在多个 user ,激活 Dhizuku 过程中不允许其他 user 存在。其他 user 的产生可能是因为 app clone、double app、guest 和 multi-user functions ,详见
官网说明
。解决方法:官方说明里建议是从手机设置里直接删除有关双开应用,我采用的是相关明了的“暴力”手段:
[liy@liArch-inLe platform-tools]$ ./adb shell dpm set-device-owner com.rosan.dhizuku/.server.DhizukuDAReceiver
Exception occurred while executing 'set-device-owner':
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device.
at com.android.server.devicepolicy.DevicePolicyManagerService.enforceCanSetDeviceOwnerLocked(DevicePolicyManagerService.java:9645) at com.android.server.devicepolicy.DevicePolicyManagerService.setDeviceOwner(DevicePolicyManagerService.java:8568) at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.runSetDeviceOwner(DevicePolicyManagerServiceShellCommand.java:256) at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.onCommand(DevicePolicyManagerServiceShellCommand.java:89) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.server.devicepolicy.DevicePolicyManagerService.onShellCommand(DevicePolicyManagerService.java:9967) at android.os.Binder.shellCommand(Binder.java:962) at android.os.Binder.onTransact(Binder.java:846) at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:6966) at com.android.server.devicepolicy.DevicePolicyManagerService.onTransact(DevicePolicyManagerService.java:17958) at android.os.Binder.execTransactInternal(Binder.java:1197) at android.os.Binder.execTransact(Binder.java:1156)