【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has andro
来源:互联网 发布:中国汽车材料数据批准 编辑:程序博客网 时间:2024/04/29 03:24
- 错误异常
- 产生原因
- 解决办法
- 参考链接
错误异常
java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has android.permission.READ_PHONE_STATE.
这里的getDeviceId可能是获取系统状态或内容的操作,最后的android.permission.READ_PHONE_STATE 也可能是其它权限,具体可以查看 Android文档中的权限分组 。
产生原因
使用Android Studio编译项目的时候将 app/build.gradle 中的 defaultConfig 设置中的 targetSdkVersion 设置为了23, 这样 Android Studio在编译的时候会使用 Android 23 API即Android 6.0来编译项目,但是,如果你没有给项目加上动态权限请求的话,你的应用在安装到手机的时候将不会获取任何权限!!!可以去查看应用的应用信息,其中的 Permissions 权限列表中所有的权限组都是关闭状态。
解决办法
如果你需要紧急避免自己的应用继续在Android 6.0的系统上崩溃,可以将app/build.gradle中的 targetSdkVersion和compileSdkVersion设置为22或以下版本,这样的话,编译出来的app会在Android 6.0上以兼容模式运行,可以获取需要的权限,但随着Android 6.0的普及,我还是推荐大家尽量给项目加上动态权限时的判断以及逻辑处理。
参考链接
http://stackoverflow.com/questions/33078003/android-6-0-permission-error
http://stackoverflow.com/questions/32742327/neither-user-10102-nor-current-process-has-android-permission-read-phone-state
转载自:http://www.th7.cn/Program/Android/201604/841700.shtml
- 【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has andro
- 【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has androi
- java.lang.SecurityException: Neither user 10039 nor current process has android.permissio
- java.lang.SecurityException: ConnectivityService: Neither user 10086 nor current process has android
- Caused by: java.lang.SecurityException: Neither user 10068 nor current process has android.permissio
- android 自定义接听电话时报错:java.lang.SecurityException: Neither user 10088 nor current process has android.p
- 【Android学习】java.lang.SecurityException: ConnectivityService: Neither user 10134 nor current process
- SecurityException: Neither nor current process has android.permission.INSTALL_PACKAGES
- java.lang.SecurityException: Need BLUETOOTH ADMIN permission: Neither user 10047 nor current process
- Neither user 10029 nor current process has android.permission.WRITE_MEDIA_STORAGE.
- Neither user 10029 nor current process has android.permission.WRITE_MEDIA_STORAGE.
- Exception | neither user 10075 nor current process has android.permission.ACCESS_NETWORK_STATE..
- No permission to write APN settings: Neither user 10047 nor current process has android.permission.W
- Neither user 10010 nor current process has android.permission.MANAGE_NETWORK问题
- java.lang.SecurityException: WifiService: Neither user 错误
- java.lang.SecurityException: WifiService: Neither user 1...
- java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'user'
- java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'user'
- hdu2629 Identity Card (2016xynu暑期集训检测 -----F题)
- for each删除List中的元素出错
- 常用的正则表达式校验
- SICP 1.09-1.10
- 链表操作
- 【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has andro
- SQL学习--group by
- 应届毕业生(程序员)如何工作更顺利、步步高升
- linux文件目录操作命令 cp
- hdu 1533 Going Home【KM匹配】
- 建议20:使用泛型集合代替非泛型集合
- 遇到:无法启动此程序,因为计算机在丢失 .dll。
- 克服优柔寡断
- iBatis简单入门教程