Skip to content

Latest commit

 

History

History
76 lines (62 loc) · 3.18 KB

README.md

File metadata and controls

76 lines (62 loc) · 3.18 KB

Android CI

Android Rust Service

A demo Android App with foreground service using Rust Native Libraries. The service does file-system monitoring and makes the logs available at http://localhost:3000/fs.

This demo is not tested on Windows. PR welcome!

Getting Started On Linux

A docker-compose.yml and Dockerfile are available in this repository. docker compose up should build and run the app.

  1. Install rustup

  2. Install the stable toolchain

    rustup toolchain install stable
  3. Add (required) android targets

    rustup target add aarch64-linux-android
    rustup target add armv7-linux-androideabi
    rustup target add i686-linux-android
    rustup target add x86_64-linux-android
  4. Install JDK 17

  5. Add the following environment variables

    export JAVA_HOME=/usr
    export ANDROID_HOME=$HOME/.android_sdk

    Note: The java binary should be in $JAVA_HOME/bin/

  6. Install command-line tools. Make sure that $ANDROID_HOME/cmdline-tools/latest/bin contains sdkmanager binary. Add to PATH.

    mkdir -p $ANDROID_HOME/cmdline-tools
    wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O temp.zip
    unzip -d $ANDROID_HOME/cmdline-tools temp.zip
    mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest 
    rm temp.zip
    export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
    sdkmanager --help # must work
  7. Accept SDK license .

    mkdir $ANDROID_HOME/licenses
    echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license
  8. Install dependencies using sdkmanager. The following packages are required to build the app.

    sdkmanager "build-tools;30.0.3" "emulator" "ndk;25.2.9519653" "patcher;v4" "platform-tools" "platforms;android-33"
    Path Version Description Location
    build-tools;30.0.3 30.0.3 Android SDK Build-Tools 30.0.3 build-tools/30.0.3
    emulator 32.1.13 Android Emulator emulator
    ndk;25.2.9519653 25.2.9519653 NDK (Side by side) 25.2.9519653 ndk/25.2.9519653
    patcher;v4 1 SDK Patch Applier v4 patcher/v4
    platform-tools 34.0.3 Android SDK Platform-Tools platform-tools
    platforms;android-33 2 Android SDK Platform 33 platforms/android-33
  9. Clone the repository & chdir into it and build.

    ./gradlew build

Demo

FileSystem Monitoring

FS Monitoring