I am in the middle of migrating a project to AndroidX and I am blocked with an issue.
<provider android:name="androidx.core.content.FileProvider" <--- Changed to X lib android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" <---- ISSUE android:resource="@xml/file_paths" /> </provider>
I searched all the Internet and couldn't find a solution for this: what should I add instead of android.support.FILE_PROVIDER_PATHS for AndroidX?
With Android Studio 3.2 and higher, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar. The refactor command makes use of two flags.
Migrating directly to AndroidX from an older version of the Support Library than 28 isn't recommended. If you use an older version of Support Library such as 26 or 27, it will be easier and smoother to upgrade to Support Library 28 first.
Android FileProvider is a sub class of ContentProvider. It is used to share files between different android apps. It is implemented in android v4 Support Library.
Create FileProvider Steps. Declare FileProvider provider component in AndroidManifest.xml file. Create a share folder xml file to indicate which folder will be shared. 2.1 Define FileProvider In AndroidManifest.xml.
Still the same. android.support.FILE_PROVIDER_PATHS
is in the example here
<provider android:name="androidx.core.content.FileProvider" android:authorities="com.mydomain.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider>
For androidx, the metadata should be like this. Checkout this from android studio : https://developer.android.com/reference/androidx/core/content/FileProvider.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With