权限拒绝:这需要 android.permission.INTERACT_ACROSS_USERS_FULL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20578474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:04:49  来源:igfitidea点击:

Permission Denial: this requires android.permission.INTERACT_ACROSS_USERS_FULL

androidsqlitepermissionsuser-permissions

提问by gurkan

I am having an issue with sqlite db in Android. But as I made a quick research on the internet, I suspect that the problem is not related to sqlite but system user. My app is not recognized as authorized user to access db functionalities. I tried to apply possible suggested solutions in stack overflow but none of them made a difference. This is the LogCat I am facing every time I attempt to use db functionality.

我在 Android 中遇到了 sqlite db 问题。但是当我在互联网上进行快速研究时,我怀疑问题与sqlite无关,而是与系统用户有关。我的应用程序未被识别为访问数据库功能的授权用户。我试图在堆栈溢出中应用可能的建议解决方案,但没有一个有什么不同。这是我每次尝试使用 db 功能时都面临的 LogCat。

12-14 02:35:17.721    2953-3355/? E/DatabaseUtils﹕ Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13082)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:577)
at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
at android.os.Binder.execTransact(Binder.java:388)
at dalvik.system.NativeStart.run(Native Method)

I tried to add permission

我试图添加权限

android.permission.INTERACT_ACROSS_USERS_FULL

but still no sound. The strange thing is when I try to add INTERNET permission Android Studio 0.3 (ide I use) suggests me possible permissions I can choose. But when it comes to INTERACT_ACROSS_USERS_FULL permission it behaves like it has no idea about this permission. My test device is Samsung S4 running on 4.3.

但还是没有声音。奇怪的是,当我尝试添加 INTERNET 权限时,Android Studio 0.3(我使用的 ide)建议我可以选择可能的权限。但是当涉及到 INTERACT_ACROSS_USERS_FULL 权限时,它的行为就像不知道这个权限一样。我的测试设备是运行在 4.3 上的三星 S4。

I assume that I am not the only one who tries to use db on android. So there is a solution.

我认为我不是唯一一个尝试在 android 上使用 db 的人。所以有一个解决方案。

How can I really add INTERACT_ACROSS_USERS_FULL permission to my application?

我怎样才能真正为我的应用程序添加 INTERACT_ACROSS_USERS_FULL 权限?

采纳答案by SamSPICA

According to this answer: android.permission.INTERACT_ACROSS_USERS_FULLis a signature level permission.Your app will not be able to use it until and unless it has the same signature as the system.

根据这个答案:android.permission.INTERACT_ACROSS_USERS_FULL是签名级别的权限。您的应用程序将无法使用它,除非它具有与系统相同的签名。

Which is not something you can achieve unless you either are the creator or the system build, or collaborating with them such that they are willing to sign your apk with their certificate. In other words, this is off limits for most developers.

除非您是创建者或系统构建者,或者与他们合作以便他们愿意用他们的证书签署您的 apk,否则这不是您可以实现的。换句话说,这对大多数开发人员来说是禁止的。

回答by Pelanes

I got the error android.permission.INTERACT_ACROSS_USERS_FULLbecause I had some conflicts in the bin directoryof the project. I did some changes to the my app package id and the app-file-1.apk in the bin directory doesn't match with the project.

我收到错误android.permission.INTERACT_ACROSS_USERS_FULL因为我在项目的bin 目录中有一些冲突。我对我的应用程序包 id 做了一些更改,并且 bin 目录中的 app-file-1.apk 与项目不匹配。

I did a project > cleanand checked that the bin folder was cleared and regenerated, and it works now.

我做了一个项目>清理并检查了bin文件夹是否已清除并重新生成,现在可以使用了。

回答by user7856586

Try to disable auto-fill. It works 100% on Android Oreo. Check this link

尝试禁用自动填充。它在 Android Oreo 上运行 100%。检查此链接

Simply add this code to your app :

只需将此代码添加到您的应用程序:

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        window.decorView.importantForAutofill = 
        View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS;
    }

回答by HarshMarshmallow

I had the same issue and think that I can help you out. I had registered my app with my production keystore, but was using Eclipse debug to load it into my phone. The Eclipse debug uses debug.keystore which wont match the signature of your production key and throw this error. Use the debug keystore instead for testing or send the apk to yourself and download it onto your phone.

我有同样的问题,并认为我可以帮助你。我已经在我的生产密钥库中注册了我的应用程序,但是正在使用 Eclipse 调试将它加载到我的手机中。Eclipse 调试使用 debug.keystore,它与您的生产密钥的签名不匹配并引发此错误。使用调试密钥库进行测试或将 apk 发送给您自己并将其下载到您的手机上。

回答by user3542309

I get this error when I change my minSdkVersion from 8 to 11 in my Manifest. I changed it back to 8 or 9 and no more error.

当我在 Manifest 中将 minSdkVersion 从 8 更改为 11 时出现此错误。我把它改回 8 或 9,没有更多的错误。

Try changing your minSdkVersion in your manifest. I was able to repeat the crash and error results with versions 10, 11, and 12 (my app crashes and displays "requires android.permission.INTERACT_ACROSS_USERS_FULL" in the LogCat)

尝试在清单中更改 minSdkVersion。我能够在版本 10、11 和 12 中重复崩溃和错误结果(我的应用程序崩溃并在 LogCat 中显示“需要 android.permission.INTERACT_ACROSS_USERS_FULL”)