Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Add AndroidX Manifest Instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
brminnick authored Apr 14, 2020
1 parent 1d37652 commit a8c40c1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Xamarin.Essentials.Platform.Init(this, bundle);

You must also add a few additional configuration files to adhere to the new strict mode:

1.) Add the following to your AndroidManifest.xml inside the `<application>` tags:
1a.) (Non AndroidX) Add the following to your AndroidManifest.xml inside the `<application>` tags:
```xml
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
Expand All @@ -276,9 +276,26 @@ You must also add a few additional configuration files to adhere to the new stri
</provider>
```

**Note:** If you receive the following error, it is because you are using AndroidX. To resolve this error, follow the instructions in Step `1b.)`.
> Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList

1b.) (AndroidX) Add the following to your AndroidManifest.xml inside the `<application>` tags:
```xml
<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"></meta-data>
</provider>
```

2.) Add a new folder called `xml` into your Resources folder and add a new XML file called `file_paths.xml`. Make sure that this XML file has a Build Action of: `AndroidResource`.

Add the following code:

```xml
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
Expand Down

0 comments on commit a8c40c1

Please sign in to comment.