zoukankan      html  css  js  c++  java
  • WindowManager$BadTokenException: Unable to add window permission denied for this window type

    10-11 11:47:27.472: E/AndroidRuntime(12804): java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.zhl.classguiding/cn.zhl.classguiding.XueanPdfActivity}: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@2bef0a78 -- permission denied for this window type
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.access$600(ActivityThread.java:123)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.os.Handler.dispatchMessage(Handler.java:99)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.os.Looper.loop(Looper.java:137)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.main(ActivityThread.java:4424)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at java.lang.reflect.Method.invokeNative(Native Method)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at java.lang.reflect.Method.invoke(Method.java:511)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at dalvik.system.NativeStart.main(Native Method)
    10-11 11:47:27.472: E/AndroidRuntime(12804): Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@2bef0a78 -- permission denied for this window type
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.ViewRootImpl.setView(ViewRootImpl.java:537)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:301)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.Window$LocalWindowManager.addView(Window.java:537)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at cn.zhl.classguiding.XueanPdfActivity.createFloatView(XueanPdfActivity.java:1854)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at cn.zhl.classguiding.XueanPdfActivity.onCreate(XueanPdfActivity.java:415)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.Activity.performCreate(Activity.java:4465)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
    10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
    10-11 11:47:27.472: E/AndroidRuntime(12804): ... 11 more

    修改方法:manifest.xml 添加权限

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" /> 

  • 相关阅读:
    DDOS学习笔记(《破坏之王-DDOS攻击与防范深度剖析》)
    gearman学习笔记1
    Sphinx学习笔记2
    docker学习笔记(一)
    Centos7安装配置Xhgui
    MongodDB学习笔记(二)(复制)
    MongoDB学习笔记(一)
    0927 DP 小测 #1
    「NOI 2011」阿狸的打字机 「AC 自动机」「数据结构」
    「POI 2005」SZA-Template 「失配树」「双向链表」「思维」
  • 原文地址:https://www.cnblogs.com/zgqys1980/p/5178975.html
Copyright © 2011-2022 走看看