talaria-im / talaria

<insert buzzwords> instant messaging application
Mozilla Public License 2.0
6 stars 0 forks source link

Set up an Android project #2

Open 9ary opened 3 years ago

9ary commented 3 years ago

The Android version is a solid choice for the MVP.

expectocode commented 3 years ago

I'm looking into this

expectocode commented 3 years ago

re: supported versions, this is a useful thing to keep in mind: image

expectocode commented 3 years ago

Figure out how to integrate Rust into an Android project

https://github.com/Dushistov/flapigen-rs https://github.com/jni-rs/jni-rs https://github.com/rust-windowing/android-ndk-rs/blob/fe3576c8d8a5b54f09475dcb0bb530e56df60eb1/ndk-examples/examples/jni_audio.rs

https://github.com/Dushistov/flapigen-rs/issues/277 https://stackoverflow.com/questions/61220627/rust-jni-async-callback-with-tokio-and-reqwest-for-android

expectocode commented 3 years ago

https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html mentions API layer 26 so we might want to go with that.

expectocode commented 3 years ago

https://robertohuertas.com/2019/10/27/rust-for-android-ios-flutter/ details making an Android Library (2019)

expectocode commented 3 years ago

See branch https://github.com/9ary/talaria/tree/rust-jni. To run, you need to run scripts/android_build.sh and then run in Android Studio (we could integrate this into a cargo or gradle workflow)

Prerequisites: Install the Android SDK/NDK (and set ANDROID_NDK_HOME if it's not the default location) cargo install cargo-ndk rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

expectocode commented 3 years ago

Now that I've been experimenting with Jetpack Compose and the jni crate, it's clear that debugging the rust calls is a pain point. Redirecting stdout/stderr would be a good start, and some logging and backtraces would help a lot too. https://crates.io/crates/ndk seems to have a lot of nice features in this area (and other jni annoyances) but I'm not sure if it will integrate with Compose.