我正在尝试使用隐式意图ACTION_SEND将Chrome浏览器中的图像共享到我的应用程序。
在共享搜索到的图片时,应用会收到内容URI的意图,如下所示:content://com.android.chrome.FileProvider/images/screenshot/1457448067808912906311.jpg
使用 ContentResolver 和 openInputStream()来读取与内容Uri相关联的字节数,它会导致应用程序崩溃安全异常:权限拒绝
这是堆栈跟踪:
Caused by java.lang.SecurityException: Permission Denial: opening provider org.chromium.chrome.browser.util.CompatibilityFileProvider from ProcessRecord{e2de807 31401:com.theteamie.android.app/u0a784} (pid=31401, uid=10784) that is not exported from uid 10060
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3576)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:4799)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2018)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1466)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1087)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:942)
at android.content.ContentResolver.openInputStream(ContentResolver.java:662)
at com.theteamie.android.app.activity.PostShareActivity.copyToLocalFile(PostShareActivity.java:141)
at com.theteamie.android.app.activity.PostShareActivity.processChosenFile(PostShareActivity.java:103)
at com.theteamie.android.app.activity.PostShareActivity.onCreate(PostShareActivity.java:72)
at android.app.Activity.performCreate(Activity.java:6259)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
过去几天我编写此功能时就已经开始工作了。我从这个SO question的答案得到了帮助。有人可以建议现在可能导致此问题的原因吗?
答案 0 :(得分:0)
请确保您尝试从Android Manifest中设置ACTION_SEND的同一活动中获取图片。上述问题最可能的原因