InputStreaminputStreamgetContentResolver().openInputStream(uri)在 Android 开发中服务端向客户端返回 Uri客户端在读取 Uri 时出现如下错误信息java.lang.SecurityException: Permission Denial: opening provider androidx.core.content.FileProvider from ProcessRecord{d8ff2c 25776:com.my.client/u0a248} (pid25776, uid10248) that is not exported from UID 10247问题原因客户端没有权限访问服务端通过 FileProvider 共享的文件务端的 FileProvider 设置了exportedfalse但客户端没有获得临时权限处理策略正确授予客户端临时权限UriuriFileProvider.getUriForFile(ServerService.this,getApplicationContext().getPackageName().fileprovider,file);// 授予临时权限// 第一个参数是客户端应用包名grantUriPermission(com.my.client,uri,Intent.FLAG_GRANT_READ_URI_PERMISSION);