An Android application for ruffle.rs
Go to file
2023-08-06 23:34:31 +02:00
.github/workflows Split native (parallel) and APK build stages on GH, support all 4 archs, build universal and single-arch APKs 2023-08-06 23:34:31 +02:00
app Split native (parallel) and APK build stages on GH, support all 4 archs, build universal and single-arch APKs 2023-08-06 23:34:31 +02:00
native Split native (parallel) and APK build stages on GH, support all 4 archs, build universal and single-arch APKs 2023-08-06 23:34:31 +02:00
README.md Update README 2023-03-22 08:35:24 +01:00

This is a native Android application for Ruffle.

It is in a very early stage.

Prebuilt APKs

The latest (successful) Actions run (here) should have a debug and a release .apk uploaded as artifacts.

You can try this app by downloading and installing one of those.

Build Prerequisites

Install Android Sudio with at least the Platform SDK (e.g. 28) and the NDK Tools (at least r24 needed due to https://github.com/rust-windowing/android-ndk-rs/issues/255).

Also:

cargo install cargo-apk

rustup target add aarch64-linux-android armv7-linux-androideabi

Build Steps

NOTE: First a sacrificial APK is built, then the native library it produces is used to build the proper APK.

Substitute the appropriate locations and NDK version in the variables set for the cargo-apk command.

cd native
# don't specify a `--target` here, as that changes the directory structure
ANDROID_SDK_ROOT=$HOME/Android/Sdk/ ANDROID_NDK_ROOT=$HOME/Android/Sdk/ndk/24.0.8215888/ cargo apk build --release

mkdir ../app/ruffle/src/main/jniLibs
cp -r target/release/apk/lib/* ../app/ruffle/src/main/jniLibs/

cd ../app
./gradlew assembleDebug # the "release" version requires a keyfile

The final APK should be at:

app/ruffle/build/outputs/apk/debug/ruffle-debug.apk

After the first step, simply opening the app project in Android Studio for development also works.


TODO

In no particular order:

  • Ability to show the built-in virtual keyboard (softinput), for text input
  • Controller/Gamepad input?
    • Mapped to key presses and/or virtual mouse pointer
  • Own custom keyboard overlay, maybe even per-content configs
    • Not an overlay, and not per-content, but custom keyboard is there
  • Navigator backend (fetch, open browser)
  • Error/panic handling
  • Loading "animation" (spinner)
  • Logging?
  • Alternative audio backend (OpenSL ES) for Android < 8
  • UI backend (context menu)
  • Proper storage backend?
  • Cross-platform build instructions?
  • Resolve design glitches/styling/theming (immersive mode, window insets for holes/notches/corners)
  • Support for x86(_64) tablets?
  • Publish to various app stores, maybe automatically?
  • Consider not building the intermediate .apk just for the shared libraries
  • Simplify build process (hook cargo-apk into gradle, drop cargo-apk?)
  • Bundle demo animations/games
  • Add ability to load content from well known online collections? (well maybe not z0r... unless?)
  • History, favorites, other flair...?
  • Clean up ~everything

DONE:

  • Touch/mouse input
  • Keyboard input: only with physical keyboard connected or through scrcpy
  • Split into a separate repo
  • Add ability to Open SWF by entered/pasted URL (or even directly from clipboard)
    • No direct clipboard open, but easy to paste into the text field...
  • Unglitchify rendering: scale, center and letterbox the content properly
  • Ask CPAL/Oboe to open a "media" type output stream instead of a "call" one
    • so the right volume slider controls it, and it uses the loud(er)speaker
    • -> solved by switching to a direct AAudio (ndk-audio) backend
  • Add building this to CI, at least to the release workflow
    • This repo has its own CI setup, which builds APKs
  • Somehow filter files to be picked to .swf
    • How well this works depends on the file picker, but it "should work most of the time"
  • Unglitchify audio volume (buttons unresponsive?)
  • Register Ruffle to open .swf files
    • How well this works depends on the application opening the file, but it "should work most of the time"
  • Figure out why videos are not playing (could be a seeking issue)
    • The video decoder features weren't enabled on ruffle_core...
  • Sign the APK
    • Using a very simple key for now, with just my name in it
  • Support for 32-bit ARM phones
    • Untested, but should work in theory
  • Unbreak the regular build on CI
    • No longer relevant after the repo split
  • Clean up commit history of the branch
    • No longer relevant after the repo split