我正在尝试请求获得读取存储的权限.在最近的
Android Studio升级之后,我开始收到错误“不幸的是,Package Installer已经停止”,同时请求权限并且没有出现权限请求对话框.
这是我请求权限的代码段
int readPermission = ContextCompat.checkSelfPermission(this,Manifest.permission.READ_EXTERNAL_STORAGE); int writePermission = ContextCompat.checkSelfPermission(this,Manifest.permission.WRITE_EXTERNAL_STORAGE); if (readPermission != PackageManager.PERMISSION_GRANTED || writePermission != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_READWRITE_STORAGE); } }