java.lang.SecurityException: getImeiForSlot: The user 10282 does not meet the requirement


这两天项目升级Android 编译版本,将build.gradle 中的 compileSdkVersion 升级到 29后,发现APP在Android 10 及Android 11设备上在调用获取设备信息的时候崩溃了。

问题描述:
Android 编译版本升级为29后,在Android 10 和Android 11 手机上获取设备信息崩溃,报错
java.lang.SecurityException: getImeiForSlot: The user 10282 does not meet the requirements to access device identifiers.

 

解决方案:

1、降低targetSdkVersion版本

我们可以将支持版本降低到 29 一下,也就是 targetSdkVersion=28 这样就可以解决问题了。但是这种做法不建议,毕竟后面还是要升级到新版本的。

 

参考:https://blog.csdn.net/u013132758/article/details/111326319


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM