This example shows how to write custom java code in android/app/src and call it using bindings generated by jnigen.
Run flutter run to run the app.
To regenerate bindings after changing Java code, run dart run tool/jnigen.dart. This requires at least one APK build to have been run before, so that jnigen can obtain classpaths of Android Gradle libraries. Therefore, run flutter build apk once before generating bindings for the first time, or after a flutter clean.
These are general steps to integrate Java code into a Flutter project using jnigen.
android/ subproject of the flutter app.jnigen configuration script like tool/jnigen.dart in this example.dart run.@Keep annotation (androidx.annotation.Keep) for code written in the application itself, or a proguard-rules file for external libraries.