导入账户

问题描述:

大家。 在我的应用程序中,我尝试创建一个新帐户,但在添加它时遇到了一个SecurityException:“caller uid 10028与认证者的uid不同”。我的代码是:导入账户

AccountManager accountManager = null; 

accountManager = AccountManager.get(this); 

Account sampleAccount = new Account(ACCOUNT_NAME, ACCOUNT_TYPE); 

boolean isSuccess=false; 

if (accountManager != null) { 

try { 

    isSuccess = accountManager.addAccountExplicitly(sampleAccount, 
         ACCOUNT_PASSWORD, null); 

} catch (Exception e) { 

    Log.e(TAG, e.getMessage()); 
} 

任何人都可以帮我吗?

也许这个链接将帮助:

http://loganandandy.tumblr.com/post/613041897/caller-uid-is-different

这听起来像是由常数指定ACCOUNTTYPE不会在帐户认证元素的XML定义的ACCOUNTTYPE匹配,如果他们这样做不匹配,它抛出这个异常。