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

Commit

Permalink
Closes #325 (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
HosseinYousefi authored Jul 31, 2023
1 parent b6f97bf commit be7a930
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions jnigen/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ This directory contains examples on how to use jnigen.

| Directory | Description |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [in_app_java](in_app_java/) | Demonstrates how to include custom Java code in Flutter application and call that using jnigen |
| [pdfbox_plugin](pdfbox_plugin/) | Example of a flutter plugin which provides bindings to Apache PDFBox library. Currently works on Flutter desktop and Dart standalone on linux. |
| [notification_plugin](notification_plugin/) | Example of a reusable Flutter plugin with custom Java code which uses Android libraries. |
| [kotlin_plugin](kotlin_plugin/) | Example of using jnigen to generate bindings for Kotlin. |
| [in_app_java](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/in_app_java/) | Demonstrates how to include custom Java code in Flutter application and call that using jnigen |
| [pdfbox_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/pdfbox_plugin/) | Example of a flutter plugin which provides bindings to Apache PDFBox library. Currently works on Flutter desktop and Dart standalone on linux. |
| [notification_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/notification_plugin/) | Example of a reusable Flutter plugin with custom Java code which uses Android libraries. |
| [kotlin_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/kotlin_plugin) | Example of using jnigen to generate bindings for Kotlin. |

We intend to cover few more use cases in future.

Expand All @@ -16,12 +16,12 @@ We intend to cover few more use cases in future.
### Dart package (Standalone only)

- Create dart package, add `jni` as dependency and `jnigen` as dev dependency.
- Write the jnigen config similar to [the one in pdfbox_plugin](pdfbox_plugin/jnigen.yaml).
- Write the jnigen config similar to [the one in pdfbox_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/pdfbox_plugin/jnigen.yaml).
- Generate JNI bindings by running `dart run jnigen --config jnigen.yaml`.

- In the CLI project which uses this package, add this package, and `jni` as a dependency.
- Run `dart run jni:setup` to build native libraries for JNI base library and jnigen generated package.
- Import the package. See [pdf_info.dart](pdfbox_plugin/dart_example/bin/pdf_info.dart) for an example of using JNI from dart standalone.
- Import the package. See [pdf_info.dart](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/pdfbox_plugin/dart_example/bin/pdf_info.dart) for an example of using JNI from dart standalone.

### Flutter FFI plugin

Expand All @@ -42,7 +42,7 @@ To create an FFI plugin with JNI bindings:
- Create an FFI plugin with Android as the only platform.
- Build the example/ Android project using command `flutter build apk`. After a release build is done, jnigen can use a gradle stub to collect compile classpaths.
- Write your custom Java code in `android/src/main/java` hierarchy of the plugin.
- Generate JNI bindings as described above. See [notification_plugin/jnigen.yaml](notification_plugin/jnigen.yaml) for example configuration.
- Generate JNI bindings as described above. See [notification_plugin/jnigen.yaml](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/notification_plugin/jnigen.yaml) for example configuration.

### Pure dart bindings

Expand Down

0 comments on commit be7a930

Please sign in to comment.