问题描述:
解决AndroidN 上 安装Apk时报错:android.os.FileUriExposedException: file:///storage/emulated/0/download/%E5%85%A8%E5%90%8D%E7%82%B9%E6%BB%B4 exposed beyond app through Intent.getData()
解决方法:
1、在AndroidManifest.xml中添加如下代码
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="app包名.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
注意事项:
authorities:app的包名.fileProvider
grantUriPermissions:必须是true,表示授予 URI 临时访问权限
exported:必须是fa