I am encountering an error setting the device owner on an android device using the steps below. This has worked in the past on other devices:
From command line run the following on the connected device:
adb install -r myapp.apk
adb shell "dpm set-device-owner com.mydomain.myapp/.ServiceDeviceAdminReceiver"
The following error occurs:
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device
Under Settings > Accounts (there are no accounts listed)
Under Settings > Security > Device Administrators (there are 2 apps and both are unchecked): Android Device Manager
Myapp
I then ran the following commands and received the following output:
adb shell pm list users
Users:
UserInfo{0:Owner:13} running
adb shell dumpsys device_policy
Current Device Policy Manager state:
Enabled Device Admins (User 0):
mPasswordOwner=-1
Any suggestions on what I can do to set the device owner?
Open the Settings app and tap Accounts. Add the work account again and set up Android Device Policy. During enrollment, you must set up a work profile because it's required for Android Device Policy.
DPC identifier methodFollow the setup wizard on a new or factory-reset device. Enter Wi-Fi login details to connect the device to the internet. When prompted to sign in, enter afw#setup, which downloads Android Device Policy. Scan a QR code or manually enter an enrollment token to provision the device.
To avoid this issue, make sure your WiFi connection signal is strong in the place where you setup devices. Note: if you see this error message, do not click Reset, but reboot the device. If you aren't able to enter the QR code scanner after reboot by tapping the welcome screen 6 times, reboot the device again.
You need to remove all accounts from the device too, that means no sign in of any sort, even google, skip that step after factory reset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With