Skip to content

Commit

Permalink
Added Android setup steps (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicajilau authored Jan 7, 2025
1 parent 611bdda commit 6e379de
Showing 1 changed file with 46 additions and 9 deletions.
55 changes: 46 additions & 9 deletions packages/pasteboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

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

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

| | |
|---------|-----|
| Windows | βœ… |
| Linux | βœ… |
| macOS | βœ… |
| iOS | βœ… |
| Web | βœ… |
| Platform | Supported | Requires Setup |
|----------|---------- |--------------- |
| Windows | βœ… | No |
| Linux | βœ… | No |
| macOS | βœ… | No |
| iOS | βœ… | No |
| Web | βœ… | No |
| Android | βœ… | Yes |

## Getting Started

1. add `package:pasteboard` to `pubspec.yaml`
1. Add `package:pasteboard` to `pubspec.yaml`:

```yaml
dependencies:
Expand All @@ -40,6 +41,42 @@ A flutter plugin which could read image,files from clipboard and write files to
}
```

## Android Setup
To use this package on Android without errors, follow these steps:

1. Add the following `<provider>` entry inside the `<application>` tag in your AndroidManifest.xml (`android/app/src/main/AndroidManifest.xml`):

```xml
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
```
2. Create the file `provider_paths.xml` at `android/app/src/main/res/xml/provider_paths.xml` with the following content:

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

### Common Issues
If these steps are not followed, you may encounter the following runtime error:

```
Couldn't find meta-data for provider with authority
```

Make sure the `<provider>` entry is correctly added to the `AndroidManifest.xml` and that the `provider_paths.xml` file exists in the correct location.

## License

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

0 comments on commit 6e379de

Please sign in to comment.