I am trying to upgrade a working old app to support Android API 26, and one of the thing I need to use is android.support.v4.content.FileProvider - but it was not found.
As of AndroidX (the repackaged Android Support Library), the path is androidx.core.content.FileProvider
so the updated provider tag would be:
<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/file_paths" />
</provider>
Android Support Libraries are now in the androidx.*
package hierarchy.
android.*
is now reserved to the built-in Android System Libraries.
Create your class
import android.support.v4.content.FileProvider;
public class GenericFileProvider extends FileProvider {
}
Add this provider into your AndroidManifest.xml under application tag:
<provider
android:name=".utilities.GenericFileProvider"
android:authorities="${applicationId}.utilities.GenericFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>