Error内容
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider:
java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider"
解決方法
1 : paths.xmlを作成
2 : AndroidManifest.xmlにFileProviderを定義する
原因
APIレベル24以上でのGoogleによる仕様変更が原因です。
developer.android.com
解説
1 : paths.xmlを作成
2 : AndroidManifest.xmlにFileProviderを定義する
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/paths" />
</provider>
</application>
</manifest>
補足
「android.support.v4.content.FileProvider」 ではなく
「androidx.core.content.FileProvider」 を定義してください。