Skip to content

Latest commit

 

History

History
115 lines (83 loc) · 3.01 KB

DEVELOPMENT.md

File metadata and controls

115 lines (83 loc) · 3.01 KB

Development setup

Requirements

  • Flutter
  • Rust nightly

Icons

cd app
flutter pub get
flutter pub run flutter_launcher_icons

Generate Flutter Rust bridge bindings

From app directory.

flutter_rust_bridge_codegen \
    -r native/src/api.rs \
    -d lib/bridge_generated.dart \
    -c ios/Runner/bridge_generated.h \
    -e macos/Runner/

On Fedora Silverblue:

set -x CPATH "$(clang -v 2>&1 | grep "Selected GCC installation" | rev | cut -d' ' -f1 | rev)/include"

flutter_rust_bridge_codegen --llvm-path /usr/lib64/libclang.so.14.0.0 \
    -r native/src/api.rs \
    -d lib/bridge_generated.dart \
    -c ios/Runner/bridge_generated.h \
    -e macos/Runner/

iOS

cd app
flutter create --platforms=ios .
cargo install -f cargo-xcode
cargo install -f [email protected]
rustup target add aarch64-apple-ios
  • Follow Flutter Rust bridge setup for iOS1
  • Modify how Xcode strips symbols2
    • In Xcode, go to Target Runner > Build Settings > Strip Style.
    • Change from All Symbols to Non-Global Symbols.

Mac

cd app
flutter create --platforms=macos .
cargo install -f cargo-xcode
cargo install -f [email protected]
  • Follow Flutter Rust bridge setup for Mac1
    • Instead of dylib as suggested in the guide I am linking static lib (just like on iOS)
  • Under Signing & Capabilities
    • Check "Outgoing connections" for both Debug and Release profiles
  • Modify how Xcode strips symbols2
    • In Xcode, go to Target Runner > Build Settings > Strip Style.
    • Change from All Symbols to Non-Global Symbols.

Android

cd app
flutter create --platforms=android .
cargo install -f cargo-ndk
cargo install -f [email protected]
rustup target add \
    aarch64-linux-android \
    armv7-linux-androideabi \
    x86_64-linux-android
  • In Android Studio also install:

    • Android SDK Command-line Tools
    • NDK
  • Follow Flutter Rust bridge setup for Android3

    • Or see their sample project4
    • Add to ~/.gradle/gradle.properties (using absolute path is a requirement): ANDROID_NDK=/var/home/roman/Android/Sdk/ndk/25.0.8775105 Mac: ANDROID_NDK=/Users/roman/Library/Android/sdk/ndk/25.1.8937393

Running on physical Android device

You have two options:

  1. Either clear debug signing config not to use release keystore
  2. Or set up keystore (see "Android: First time setup" section in RELEASE.md)

Footnotes

  1. https://cjycode.com/flutter_rust_bridge/integrate/ios.html 2

  2. https://docs.flutter.dev/development/platform-integration/ios/c-interop#stripping-ios-symbols 2

  3. https://cjycode.com/flutter_rust_bridge/integrate/android_tasks.html

  4. https://github.com/Desdaemon/flutter_rust_bridge_template/blob/main/android/app/build.gradle