Getting Error while requesting READ_CONTACTS permission Android M

半腔热情 提交于 2019-12-08 14:19:44

Looking at the source for GrantPermissionsActivity, the only place in the computePermissionGrantState() method that you could get a NullPointerException from an Attempt to get length of null array is in this line:

for (int i = 0; i < callingPackageInfo.requestedPermissions.length; i++) {

Since you've stated that you have indeed listed the READ_CONTACTS permission in the manifest, it would follow that it's just in the wrong place, and is effectively not there. Ensuring that the <uses-permission> element is outside of the <application> tags solves the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!