我收到错误消息

java.lang.SecurityException: uid 10178 cannot explicitly add accounts of type: net.roughdesign.swms

即使使用我可以创建的最基本的示例。 它包括:

帐号配置

strings.xml中的帐户类型

net.roughdesign.swms

authenticator.xml

android:accountType="@string/accounts__account_type"

android:icon="@drawable/ic_add_black_24dp"

android:smallIcon="@drawable/ic_add_black_24dp"

android:label="@string/global__authenticator_account_label"

/>

SwmsAccountAuthenticator.kt

class SwmsAccountAuthenticator(val context: Context) : AbstractAccountAuthenticator(context) {

override fun addAccount(

response: AccountAuthenticatorResponse, accountType: String, authTokenType: String?,

requiredFeatures: Array?, options: Bundle?

): Bundle? {

return null

}

override fun confirmCredentials(response: AccountAuthenticatorResponse, account: Account, options: Bundle?)

: Bundle? {

return null

}

override fun editProperties(response: AccountAuthenticatorResponse?, accountType: String?): Bundle? {

return null

}

override fun getAuthToken(

response: AccountAuthenticatorResponse, accountInput: Account, authTokenType: String, options: Bundle?

): Bundle? {

return null

}

override fun getAuthTokenLabel(authTokenType: String): String? {

return null

}

override fun hasFeatures(response: AccountAuthenticatorResponse, account: Account, features: Array)

: Bundle? {

return null

}

override fun updateCredentials(

response: AccountAuthenticatorResponse, account: Account, authTokenType: String?, options: Bundle?

): Bundle? {

return null

}

}

SwmsAuthenticatorService.kt

class SwmsAuthenticatorService : Service() {

override fun onBind(intent: Intent?): IBinder? {

val authenticator = SwmsAccountAuthenticator(this)

return authenticator.iBinder

}

}

最后,在AndroidManifest.xml中

android:name=".users.SwmsAuthenticatorService"

android:exported="false">

android:name="android.accounts.AccountAuthenticator"

android:resource="@xml/authenticator" />

...

尝试使用

我尝试以此创建一个帐户:

val username = "myUserName"

val password = "myPassword"

val accountManager = AccountManager.get(this)

val accountType = getString(R.string.accounts__account_type)

val account = Account(username, accountType)

val accountAdded = accountManager.addAccountExplicitly(account, password, null)

然后对于最后一行( accountManager.addAccountExplicitly ),我收到上述错误:

java.lang.SecurityException: uid 10178 cannot explicitly add accounts of type: net.roughdesign.swms

at android.os.Parcel.readException(Parcel.java:2013)

at android.os.Parcel.readException(Parcel.java:1959)

at android.accounts.IAccountManager$Stub$Proxy.addAccountExplicitly(IAccountManager.java:1205)

at android.accounts.AccountManager.addAccountExplicitly(AccountManager.java:878)

at net.roughdesign.swms.swmsandroid.users.AuthenticateActivity.submit(AuthenticateActivity.kt:68)

...

我完全不知道这里仍然是什么问题。 据我所知,通过在清单中添加部分,帐户类型(net.roughdesign.swms)已在我的应用程序中“注册”,但我认为android不接受“这是我的”。

这里仍然是什么问题?

android 无法添加帐户,android - Android SecurityException:uid xxxxx无法显式添加帐户 - 堆栈内存溢出...相关推荐

  1. android tmp目录权限不够,android - 使用root用户安装APK,处理“ / data / local / tmp /”文件夹的新限制 - 堆栈内存溢出...

    背景 到目前为止,我可以通过以下代码使用root(在应用程序内)安装APK文件: pm install -t -f fullPathToApkFile 并且如果我想(尝试)安装到sd-card: pm ...

  2. android计步器摘要,ios - Healthkit每小时活动摘要包含步数,距离和卡路里? - 堆栈内存溢出...

    查询Healthkit应返回包含步长,距离和卡路里的数组对象. 我能够单独归还他们 活动步骤/小时 func activitySteps(_ startDate:NSDate, endDate:NSD ...

  3. android alarm 的权限,android - Android权限被拒绝-com.android.alarm.permission.SET_ALARM - 堆栈内存溢出...

    我正在尝试通过我的应用设置闹钟,但是当我通过执行以下操作启动意图时,如下所述: 如何在Android中使用意图启动闹钟屏幕? public boolean onMenuItemSelected(int ...

  4. android 电视安装apk文件损坏,android - 无法在Android电视盒上安装APK - 堆栈内存溢出...

    我正在为Android TV编写应用程序. 它可以在模拟器上正常运行,并在Android电视盒上以调试模式运行. 但是,当我使用Android Studio生成apk并尝试将该apk安装在同一盒子上时 ...

  5. android studio 抽屉,java - Android导航抽屉(由Android Studio默认提供) - 堆栈内存溢出...

    当我按下导航菜单项的更改时,它的颜色为黄色,直到释放时一直按它为默认.我没有明确编写任何代码来设置这些设置. 我该如何停止?请帮忙. 这是我的代码. 主要布局 xmlns:android=" ...

  6. mac android sdk manager速度慢,android - SDK Manager无法在Mac上打开 - 堆栈内存溢出

    当我尝试打开sdkmanager时,它在终端上说 inconsistent location '/Users/username/Library/Android/sdk/build-tools/28.0 ...

  7. android 三星 oom,android - 终结者抛出未捕获的异常:谷歌API错误或三星内核错误? - 堆栈内存溢出...

    在我的Galaxy Tab 2(三星)上启动我的应用程序时,我一直收到此错误. 我正在开发的应用程序非常复杂,很难找到此错误源自何处. 所以我开始逐个删除我的应用程序,我最终得到了一个mapview应 ...

  8. android ?attr得到状态栏高度,android - 状态栏下方的CoordinatorLayout + CollapsingToolbarLayout滚动 - 堆栈内存溢出...

    我的布局有一个奇怪的问题. 我有一个带有CollapsingToolBarLayout的CoordinatorLayout . 我有一个透明的状态栏,可以在顶部更好地显示图像. 因此,我在此Image ...

  9. Android 找不到资源异常,cordova - 离子3错误:找不到资源xml / network_security_config - 堆栈内存溢出...

    当我尝试运行" ionic cordova build android"时,出现以下异常: 匿名资源链接失败J:\\ workspaces \\ APCO \\ App \\ ap ...

最新文章

  1. 广义互相关计算TDOA
  2. vi/vim 使用
  3. 虚拟机windows xp 下安装配置mysql cluster 7.3.2
  4. 两点之间直线只有一条,曲线却有无数条,哪条才是最短的?
  5. js获取当前时间格式YYYY/MM/DD
  6. Idea 插件 lombok 的安装和使用
  7. python __init__.py的作用是什么?
  8. SQL Server 聚合函数算法优化技巧
  9. Kettle处理300万条数据-问题整理
  10. 极光推送 简书android,极光推送 (具体步骤,指导操作,推送成功)
  11. EL调用的是poji实体类的get方法
  12. 弘辽科技:拼多多DSR动态评分有多么的重要
  13. 2022-爬虫-Selenium-百度安全验证
  14. OpenCV (c++)使用KDTree时,得到正确结果后报Segmentation fault (core dumped)
  15. <第2.5个月>新店日记,shopee要投入多少钱?利润怎么样能赚钱吗好做吗?shopee孵化期考核
  16. 如何用C#+WinRAR 实现压缩
  17. 利用k8s集群部署第一个容器化应用
  18. flask后端接受图片文件数据
  19. 方便实用的--股票涨跌停价计算器
  20. docker删除镜像时报错解决办法

热门文章

  1. 2006年9月15日
  2. DP(动态规划)总结
  3. php 递归 递归方式与算法
  4. 软件测试和软件开发哪个发展更好
  5. Android Studio创建虚拟机选定指定位置
  6. 浅谈人工智能:现状、任务、构架与统一
  7. 花店小程序商城开发,开展线上引流渠道
  8. 全国计算机四级之网络工程师知识点(四)
  9. mysql中如何根据表名找到库名
  10. 用token实现单点登录