【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has androi
来源:互联网 发布:淘宝店要营业执照吗 编辑:程序博客网 时间:2024/04/29 07:25
- 错误异常
- 产生原因
- 解决办法
- 参考链接
错误异常
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
- 【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has androi
- 【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has andro
- 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'
- JSP使用jstl标签报错,jsp页面提示找不到build path
- Socket分片:基于Netty的Java实现
- iOS-Core-Animation-Advanced-Techniques(四)
- Cent OS 7 x64 grub出错救援
- 剑指offer面试题 旋转数组的最小数字
- 【Android】java.lang.SecurityException: getDeviceId: Neither user xxxxx nor current process has androi
- Spring——jar包详解
- Mybatis中resultMap
- angularjs过滤器(filter)
- 前端学习 HTML学习
- jquery学习01(入门)
- 取消chrome表单自动填充去掉input黄色背景解决方案
- 使用cocoaPods 导入第三方库 出现 关联错误问题
- 在Unity中对SQLite的增删改查的简单封装