背景
当我在Android 7.0及以下手机运行启动页,进行Activity跳转的时候,完美跳转到对应的目标Activity。 但当在Android 8.0
及以上手机进行Activity跳转时,会爆如下错误:
java.lang.SecurityException: Permission Denial: null asks to run as user 450 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:1942) at android.os.Parcel.readException(Parcel.java:1888) at android.view.autofill.IAutoFillManager$Stub$Proxy.addClient(IAutoFillManager.java:326) at android.view.autofill.AutofillManager.ensureServiceClientAddedIfNeededLocked(AutofillManager.java:896) at android.view.autofill.AutofillManager.notifyViewExited(AutofillManager.java:487) at android.view.View.notifyEnterOrExitForAutoFillIfNeeded(View.java:6945) at android.view.View.dispatchAttachedToWindow(View.java:17413) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1658) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98)复制代码
常规解决方法
按StackOverFlow
上面的方法增加权限
复制代码
发现并没有什么作用!!!!
我的解决方法
解决历程
经过几个小时的排查发现,当我的目标Activity继承AppCompatActivity
时 程序没有问题。当目标Activity继承我自己的BaseActivity
(我这个BaseActivity最终也会继承AppCompatActivity
)时就会出现问题。
完美解决方法
我自己的BaseActivity
里面有一个用于获取用户ID的**public void getUserId()
方法,就是这货。 当你把这个方法改过名字(例如:getLocalUserId()
)或者修改该getUserId()为private时,程序完美运行。 因此,可以知道这个getUserId()*是在原基类里面有实现的。
最后,希望我的方法能帮助到各位小伙伴。Thx~