
清单文件中加上
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.asd.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
filepath文件
<resources>
<paths>
<root-path
name="photos"
path="" />
</paths>
</resources>
要确定清单文件中的authorities 和 FileProvider.getUriForFile(...)中的 authority 值是一样的
本文介绍如何在Android应用中正确配置FileProvider以实现文件共享。主要内容包括在清单文件中添加provider标签,设置authorities属性,并确保其与FileProvider.getUriForFile(...)中的authority值保持一致。
3853

被折叠的 条评论
为什么被折叠?



