首页 > 解决方案 > 在 Samsung Galaxt S9 (Oreo) 上显示安全异常

问题描述

我的应用程序可在除三星 Galaxy S9 (Oreo) 之外的所有其他设备上运行。

那是我唯一的奥利奥手机。它工作正常的所有其他手机(Moto g4 plus、三星 A8、三星 Galaxy S7 等)。

奥利奥中是否添加了任何新的安全功能?

我无法发现它。有谁知道?

在下面登录

java.lang.SecurityException: 
   at android.os.Parcel.readException (Parcel.java:1958)
   at android.os.Parcel.readException (Parcel.java:1904)
   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:7577)
   at android.view.View.dispatchAttachedToWindow (View.java:18627)
   at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3527)
   at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3527)
   at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3527)
   at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3527)
   at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3527)
   at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3527)
   at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3527)
   at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2030)
   at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1738)
   at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7745)
   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)
   at android.os.Looper.loop (Looper.java:164)
   at android.app.ActivityThread.main (ActivityThread.java:6938)
   at java.lang.reflect.Method.invoke (Native Method)
   at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

标签: androidandroid-8.0-oreoandroid-securityexception

解决方案


此链接可帮助我解决问题。

我的 Activity 上有getUserId()方法。我刚刚重命名为getUserID()(正如他们在这个接受的答案中所说的那样)。

以前是

 public int getUserId() {
    SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    int temp = app_preferences.getInt("UserId", 0);
    return temp;
}

现在我把它改成了

 public int getUserID() {
    SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    int temp = app_preferences.getInt("UserId", 0);
    return temp;
}

问题已解决。有关更多详细信息,请参见此处的答案。


推荐阅读