[Android]异常8-android.view.WindowManager$BadTokenException
背景:Service服务中使用WindowManager时,Android4.4使用正常,Android6.0使用应用崩溃停止运行,提示android.view.WindowManager$BadTokenException
异常原因:
可能一>build.gradle中targetSdkVersion大于等于23版本下编译,悬浮窗权限默认是关闭没有权限,在小于23版本下编译悬浮窗权限默认是开启有权限
解决办法有:
解决一>targetSdkVersion 22;修改为小于23即可
注:
当前使用的编译器是:Android Studio2.1.2
[Android]异常8-android.view.WindowManager$BadTokenException的更多相关文章
- Android异常:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original
Android异常:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that cr ...
- Activity has leaked window that was originally added -界面退出时未关闭对话框异常 android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? -
退出Activity时弹出登录框,点击确定finish当前Activity,结果报了这个错,随后查找资料知道 原因: 是因为退出Activity时没有关闭弹出框,出现了这个错误 解决方法: 只需要在a ...
- bug_ _ android.view.WindowManager$BadTokenException: Unable to add window -- token
========4 关于android的一个常见错误:Unable to add window --token is not valid android.view.WindowManage ...
- 关于ProgressDialog.show抛出android.view.WindowManager$BadTokenException: Unable to add window
下午摆弄ProgressDialog,进入就抛错:android.view.WindowManager$BadTokenException: Unable to add window -- token ...
- android.view.WindowManager$BadTokenException: Unable to add window
这是在加载dialog时出现的一个异常.转载地址:http://hi.baidu.com/fbdfp/item/7dea2d0ade9121813d42e23d 扔了好久的android又开始断断续续 ...
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
原博客地址:http://aijiawang-126-com.javaeye.com/blog/662336 在Activity中newSpinner是我把mContext传入,但是出了 andr ...
- android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an applic
之前遇到过这样的问题, 04-12 10:40:33.302: E/AndroidRuntime(17213): Caused by: android.view.WindowManager$BadTo ...
- Android 的窗口管理系统 (View, Canvas, WindowManager)
http://blog.csdn.net/ritterliu/article/details/39295271 From漫天尘沙 在图解Android - Zygote 和 System Server ...
- Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
在广播中启动一个Dialog时出现如下错误信息:Caused by: android.view.WindowManager$BadTokenException: Unable to add windo ...
随机推荐
- noip模拟赛 序
[问题背景]zhx 给他的妹子们排序.[问题描述]zhx 有 N 个妹子, 他对第 i 个妹子的好感度为 ai,且所有 ai两两不相等. 现 在 N 个妹子随意站成一排, 他要将她们根据好感度从小到大 ...
- SCOI2010第一场
NOI2010全国青少年信息学奥林匹克竞赛 四川代表队选拔赛 第一场 题目名称 幸运数字 游戏 股票交易 英文代号 luckynumber game trade 时限 2秒 2秒 2秒 输入文件 lu ...
- 【GC概述以及查看堆内存使用】Java内存管理和GC学习
内存划分 1.JAVA内存主要划分为方法栈.方法区.堆. 2.方法栈上内存会自动释放: 3.方法区上主要加载了类的元信息.静态变量.常量.改区域又称为持久代(Perm Gen),默认是最小16M,最大 ...
- Html5 history Api简介
一. Html4的History API back() 后退,跟按下“后退”键是等效的. forward() 前进,跟按下“前进”键是等效的. go() 用法:history.go(x):在历史的范围 ...
- eclipse的Java项目修改后要不要重启tomcat问题
tomcat服务器重新部署工程或者修改了项目的代码就必须重启tomcat吗? 答: omcat服务器重新部署工程或者修改了项目的代码就必须重启tomcat吗?有没有不重启的方法,或者其他高效点的,让服 ...
- MVC中路由的一些内容详解
使用路由的好处:1.能够根据系统需求,灵活的划分请求规则(不同模块请求的URL是不一样的)2.屏蔽物理路径,提高系统的安全性,以上情况是无法根据URL分析视图文件在站点目录中的位置3.有利于搜索引擎优 ...
- Shell细小问题汇总
Shell细小问题汇总 本文原文出处: http://blog.csdn.net/bluishglc/article/details/44276607 严禁不论什么形式的转载,否则将托付CSDN官方维 ...
- React Native 中的component 的生命周期
React Native中的component跟Android中的activity,fragment等一样,存在生命周期,下面先给出component的生命周期图 getDefaultProps ob ...
- iOS_截屏并裁剪
截图使用场景: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcHJlX2VtaW5lbnQ=/font/5a6L5L2T/fontsize/400/fil ...
- 【Eclipse提高开发速度-插件篇】安装VJET插件,JS等提示开发插件
1.安装Apache Batik CSS 一般安装VJET插件会出现 Cannot complete the install because one or more required items co ...