I have a project using 2 different libraries that require ContentProvider
:
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
However, for authorities, one library instructs to use ${applicationId}.fileprovider
whilst the other one instructs ${applicationId}.provider
.
According to the Android documentation, android:authorities
is a list whose values can be separated by a semicolon.
android:authorities="list"
By that logic, doing something like this:
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider;${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
should work, however, this causes my app to crash with the following error message:
Unable to get provider androidx.core.content.FileProvider: java.lang.IllegalArgumentException: Could not find meta-data for provider with authority my.packagename.fileprovider;my.packagename.provider
I have taken a look at similar questions but the answers do not address this. How do we successfully specify multiple authorities for the same provider?