Android API 26 SecurityException问题 [英] Android API 26 SecurityException issue

查看:205
本文介绍了Android API 26 SecurityException问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一个片段和一个在该片段内的imageButton.当我在设备上运行该应用程序(Android 8-API 26)并单击imageButton时,该应用程序崩溃并引发了运行时错误,这是我之前从未见过的.

In my app I have a fragment and an imageButton inside of this fragment. When I run the app in my device (Android 8 - API 26) and click imageButton, the app crashes and throws a runtime error which I didn't see before.

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.example.mustafa.diyetisyenadmin, PID: 26366
              java.lang.SecurityException: Permission Denial: null asks to run as user 1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS
                  at android.os.Parcel.readException(Parcel.java:1945)
                  at android.os.Parcel.readException(Parcel.java:1891)
                  at android.view.autofill.IAutoFillManager$Stub$Proxy.addClient(IAutoFillManager.java:326)
                  at android.view.autofill.AutofillManager.ensureServiceClientAddedIfNeededLocked(AutofillManager.java:903)
                  at android.view.autofill.AutofillManager.notifyViewExited(AutofillManager.java:487)
                  at android.view.View.notifyEnterOrExitForAutoFillIfNeeded(View.java:6983)
                  at android.view.View.dispatchAttachedToWindow(View.java:17594)
                  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3332)
                  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3339)
                  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3339)
                  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3339)
                  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3339)
                  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3339)
                  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3339)
                  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1792)
                  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1515)
                  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7266)
                  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)
                  at android.view.Choreographer.doCallbacks(Choreographer.java:790)
                  at android.view.Choreographer.doFrame(Choreographer.java:721)
                  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
                  at android.os.Handler.handleCallback(Handler.java:808)
                  at android.os.Handler.dispatchMessage(Handler.java:101)
                  at android.os.Looper.loop(Looper.java:166)
                  at android.app.ActivityThread.main(ActivityThread.java:7425)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

因此,我在Manifest.xml中添加了所需的权限,还尝试了主题 Android权限.INTERACT_ACROSS_USERS_FULL,但出现相同的错误.我已经解决了有关此主题的自动填充问题,但是在该片段错误中,仅当我单击ImageButton时才发生.我该怎么办才能解决这个问题?

So I added the required permissions in Manifest.xml and also tried every codes in the topic Android permission.INTERACT_ACROSS_USERS_FULL but I get the same error. I have solved Autofill problem with this topic but in that fragment error occurs just only I clicked ImageButton. What should I do to solve this problem?

推荐答案

最后,我找到了解决方案.发生问题是因为我在活动中有一个名为 getUserId()的方法,该方法返回字符串user_id并将数据发送到片段.我更改了它的名称,现在一切正常.

Finally I found out the solution. Problem occurs since I had a method in my activity named getUserId() that returns String user_id and send data to fragments. I changed it's name and now everything works fine.

这篇关于Android API 26 SecurityException问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆