错误无法添加窗口android.view.ViewRootImpl$W@e46c220-窗口类型为2010的权限被拒绝

时间:2018-07-23 20:39:43

标签: javascript java android android-studio android-studio-3.0

您好,当我运行锁定屏幕应用程序时,它在锁定屏幕显示后崩溃,这是显示的期望值:

     Caused by: android.view.WindowManager$BadTokenException: 
Unable to add window android.view.ViewRootImpl$W@e46c220 -- permission denied for window type 2010

这是我完整的logcat错误日志:

    07-23 20:09:26.029 24670-24783/com.konkas.lockingscreenings E/BluetoothAdapter: Bluetooth binder is null
07-23 20:09:27.581 24670-24822/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:27.582 24670-24822/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:27.595 24670-24821/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:27.596 24670-24821/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:27.892 24670-24849/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:27.894 24670-24849/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:28.564 24670-24836/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:28.566 24670-24836/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:28.669 24670-24836/com.konkas.lockingscreenings E/BluetoothAdapter: Bluetooth binder is null
07-23 20:09:28.777 24670-24818/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:28.778 24670-24818/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:29.031 24670-24874/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:29.034 24670-24874/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:31.910 24670-24874/com.konkas.lockingscreenings E/chromium: [ERROR:gl_surface_egl.cc(289)] eglChooseConfig failed with error EGL_SUCCESS
07-23 20:09:32.179 24670-24909/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:32.183 24670-24909/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:32.266 24670-24670/com.konkas.lockingscreenings E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.konkas.lockingscreenings, PID: 24670
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.konkas.lockingscreenings/com.konkas.lockingscreenings.activity.LockNoPasscode}: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@e46c220 -- permission denied for window type 2010
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@e46c220 -- permission denied for window type 2010
        at android.view.ViewRootImpl.setView(ViewRootImpl.java:789)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
        at com.konkas.lockingscreenings.activity.LockNoPasscode.mWindowAddView(LockNoPasscode.java:341)
        at com.konkas.lockingscreenings.activity.LockNoPasscode.onCreate(LockNoPasscode.java:102)
        at android.app.Activity.performCreate(Activity.java:7009)
        at android.app.Activity.performCreate(Activity.java:7000)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
07-23 20:09:32.555 24670-24914/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:32.556 24670-24914/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
07-23 20:09:32.582 24670-24916/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 15(JVMTI_ERROR_THREAD_NOT_ALIVE) 
  07-23 20:09:32.584 24670-24916/com.konkas.lockingscreenings E/StudioProfiler: JVMTI error: 
    15(JVMTI_ERROR_THREAD_NOT_ALIVE) 

我该怎么办才能解决此错误和崩溃,我也尝试添加

android.permission.SYSTEM_ALERT_WINDOW

但是它没有帮助,我仍然不断遇到相同的错误。 我应该怎么做才能解决此错误和崩溃,我需要编辑哪些文件以及需要更改其中的代码,所以非常感谢您的帮助和支持!

0 个答案:

没有答案