Skip to content

Commit 6e379de

Browse files
authored
Added Android setup steps (#383)
1 parent 611bdda commit 6e379de

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

packages/pasteboard/README.md

+46-9
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
[![Pub](https://img.shields.io/pub/v/pasteboard.svg)](https://pub.dev/packages/pasteboard)
44

5-
A flutter plugin which could read image,files from clipboard and write files to clipboard.
5+
A Flutter plugin that allows reading images and files from the clipboard and writing files to the clipboard.
66

7-
| | |
8-
|---------|-----|
9-
| Windows ||
10-
| Linux ||
11-
| macOS ||
12-
| iOS ||
13-
| Web ||
7+
| Platform | Supported | Requires Setup |
8+
|----------|---------- |--------------- |
9+
| Windows || No |
10+
| Linux || No |
11+
| macOS || No |
12+
| iOS || No |
13+
| Web || No |
14+
| Android || Yes |
1415

1516
## Getting Started
1617

17-
1. add `package:pasteboard` to `pubspec.yaml`
18+
1. Add `package:pasteboard` to `pubspec.yaml`:
1819

1920
```yaml
2021
dependencies:
@@ -40,6 +41,42 @@ A flutter plugin which could read image,files from clipboard and write files to
4041
}
4142
```
4243

44+
## Android Setup
45+
To use this package on Android without errors, follow these steps:
46+
47+
1. Add the following `<provider>` entry inside the `<application>` tag in your AndroidManifest.xml (`android/app/src/main/AndroidManifest.xml`):
48+
49+
```xml
50+
<provider
51+
android:name="androidx.core.content.FileProvider"
52+
android:authorities="${applicationId}.provider"
53+
android:exported="false"
54+
android:grantUriPermissions="true">
55+
<meta-data
56+
android:name="android.support.FILE_PROVIDER_PATHS"
57+
android:resource="@xml/provider_paths" />
58+
</provider>
59+
```
60+
2. Create the file `provider_paths.xml` at `android/app/src/main/res/xml/provider_paths.xml` with the following content:
61+
62+
```xml
63+
<?xml version="1.0" encoding="utf-8"?>
64+
<paths xmlns:android="http://schemas.android.com/apk/res/android">
65+
<external-path
66+
name="external_files"
67+
path="." />
68+
</paths>
69+
```
70+
71+
### Common Issues
72+
If these steps are not followed, you may encounter the following runtime error:
73+
74+
```
75+
Couldn't find meta-data for provider with authority
76+
```
77+
78+
Make sure the `<provider>` entry is correctly added to the `AndroidManifest.xml` and that the `provider_paths.xml` file exists in the correct location.
79+
4380
## License
4481

4582
See the [LICENSE](LICENSE) file for the full license.

0 commit comments

Comments
 (0)