Notallowedtosetthedevice owner because there are already some accounts on thedevice

部分apk需要 adb shell dpm set-device-owner com.xxx/ .receiver.DPMReceiver 才有权限执行某些操作,比如我用的ice box
但是设置时候可能出现提示已经存在账号,解决方法:
1、检查设置 – 账号删除掉所有账号;
2、如果操作完1之后,问题依旧,显示:

java.lang.IllegalStateException:Notallowedtosetthedevice owner because there are already some accounts on thedevice

就执行如下操作:

adb shell pm list users

显示结果为:

Users:
        UserInfo{0:鏈轰富:13} running
        UserInfo{999:Multi-App:4000030} running

结果显示存在两个账户,删除第二个999即可。
adb shell pm remove-user 用户ID
adb代码如下:

adb shell pm remove-user 999

执行删除用户指令成功后会提示”Success”
然后再重新设置set-device-owner即可。
例如执行ice box的

adb shell dpm set-device-owner com.catchingnow.icebox/.receiver.DPMReceiver
  • 13
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 14
    评论
Here is an implementation of the requested classes with a brief main method to test the Account class: ```java class Account { private String accountNumber; private double balance; public Account(String accountNumber, double balance) { this.accountNumber = accountNumber; this.balance = balance; } public void deposit(double amount) { this.balance += amount; } public void withdraw(double amount) { if (this.balance - amount < 0) { System.out.println("Insufficient funds."); return; } this.balance -= amount; } public void printBalance() { System.out.println("Account balance: " + this.balance); } } class SavingsAccount extends Account { private double interestRate; public SavingsAccount(String accountNumber, double balance, double interestRate) { super(accountNumber, balance); this.interestRate = interestRate; } public void addInterest() { double interest = this.getBalance() * this.interestRate; this.deposit(interest); } } class CurrentAccount extends Account { private double overdraftLimit; public CurrentAccount(String accountNumber, double balance, double overdraftLimit) { super(accountNumber, balance); this.overdraftLimit = overdraftLimit; } @Override public void withdraw(double amount) { if (this.getBalance() - amount < -overdraftLimit) { System.out.println("Overdraft limit exceeded."); return; } super.withdraw(amount); } } class Bank { private Account[] accounts; public Bank(Account[] accounts) { this.accounts = accounts; } public void update() { for (Account account : accounts) { if (account instanceof SavingsAccount) { ((SavingsAccount) account).addInterest(); } else if (account instanceof CurrentAccount) { if (account.getBalance() < 0) { System.out.println("Sending overdraft letter to account " + account.getAccountNumber()); } } } } public void openAccount(Account account) { Account[] newAccounts = new Account[accounts.length + 1]; System.arraycopy(accounts, 0, newAccounts, 0, accounts.length); newAccounts[accounts.length] = account; accounts = newAccounts; } public void closeAccount(Account account) { Account[] newAccounts = new Account[accounts.length - 1]; int j = 0; for (int i = 0; i < accounts.length; i++) { if (accounts[i] != account) { newAccounts[j] = accounts[i]; j++; } } accounts = newAccounts; } public void payDividend(double amount) { for (Account account : accounts) { account.deposit(amount); } } } public class Main { public static void main(String[] args) { Account account1 = new Account("A001", 1000); SavingsAccount account2 = new SavingsAccount("A002", 2000, 0.01); CurrentAccount account3 = new CurrentAccount("A003", 5000, 1000); account1.deposit(500); account1.printBalance(); account1.withdraw(2000); account1.printBalance(); account2.addInterest(); account2.printBalance(); account3.withdraw(2000); account3.printBalance(); account3.withdraw(5000); account3.printBalance(); Account[] accounts = {account1, account2, account3}; Bank bank = new Bank(accounts); bank.update(); bank.openAccount(new Account("A004", 1500)); bank.closeAccount(account1); bank.payDividend(100); bank.update(); } } ``` This code creates three accounts of different types, performs some transactions on them, creates a Bank object with an array of accounts, and calls some methods on the Bank object to update accounts, open and close accounts, and pay dividends.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值