清单文件中加上
<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 值是一样的