Caused by java.lang.SecurityException: Permission Denial: opening provider com.estrongs.android.pop.app.FileContentProvider from ProcessRecord{341eeb8 5431:xx.xxxx.xxxx/u0a289} (pid=5431, uid=10289) that is not exported from uid 10188
at android.os.Parcel.readException(Parcel.java:1686)
at android.os.Parcel.readException(Parcel.java:1639)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:4199)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:5548)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2283)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1517)
at android.content.ContentResolver.query(ContentResolver.java:516)
at android.content.ContentResolver.query(ContentResolver.java:474)
at org.chromium.base.ContentUriUtils.getDisplayName(ContentUriUtils.java:181)
at org.chromium.android_webview.AwWebContentsDelegateAdapter$GetDisplayNameTask.doInBackground(AwWebContentsDelegateAdapter.java:2374)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
activity.startActivityForResult(Intent.createChooser(intent, "Open CSV"), READ_REQUEST_CODE);
1)打开画廊供挑选照片
2)从幻灯片菜单中选择ES File Explore
3)现在一些文件URI正常工作,一些文件崩溃了
注意:-FileProvider已经实施
答案 0 :(得分:1)
问题似乎出在Nougat(7.1.1)nexus(已测试!)
解决方法
从您的代码调用 getFilePathFromUri(this,uri)
public static String getFilePathFromUri(Context context, Uri _uri) {
String filePath = "";
if (_uri != null && "content".equals(_uri.getScheme())) {
//Cursor cursor = context.getContentResolver().query(contentURI, null, null, null, null);
//context.revokeUriPermission(_uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
Cursor cursor = null;
try {
cursor = context.getContentResolver().query(_uri,
new String[]
{
MediaStore.Images.ImageColumns.DATA,
MediaStore.Images.Media.DATA,
MediaStore.Images.Media.MIME_TYPE,
MediaStore.Video.VideoColumns.DATA,
}, null, null, null);
cursor.moveToFirst();
filePath = cursor.getString(0);
} catch (SecurityException e) {
//if file open with third party application
if (_uri.toString().contains("/storage/emulated/0")) {
filePath = "/storage/emulated/0" + _uri.toString().split("/storage/emulated/0")[1];
}
} finally {
if (cursor != null)
cursor.close();
}
} else {
filePath = _uri.getPath();
}
return filePath;
}