nexo/packages/messaging_flutter/docs/android-test-environment.md

3.1 KiB

Android Test Environment

This repository can use toki@toki-labs.com as a separate Android test environment when the local machine does not have an Android SDK, device, or emulator.

Remote Host

  • SSH target: toki@toki-labs.com
  • Flutter SDK: /Users/toki/SDK/flutter/bin/flutter
  • Android SDK: /Users/toki/Library/Android/sdk
  • Known usable AVD: Pixel_6_Pro_API_34

Use these environment variables for every remote Android test session:

export PATH="$HOME/SDK/flutter/bin:$HOME/Library/Android/sdk/emulator:$HOME/Library/Android/sdk/platform-tools:$HOME/Library/Android/sdk/cmdline-tools/latest/bin:$PATH"
export ANDROID_HOME="$HOME/Library/Android/sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"

Sync A Working Copy

From the local repository root, copy the current working tree to an isolated remote directory. This is useful when local changes are not committed yet.

REMOTE_DIR='$HOME/tmp/nexo-codex-test'

tar \
  --exclude='./.git' \
  --exclude='./.dart_tool' \
  --exclude='./build' \
  --exclude='./apps/flutter-test/.dart_tool' \
  --exclude='./apps/flutter-test/build' \
  --exclude='./apps/flutter-test/android/.gradle' \
  --exclude='./packages/messaging_flutter/android/.gradle' \
  --exclude='./.gradle' \
  -czf - . \
  | ssh toki@toki-labs.com "rm -rf \"$REMOTE_DIR\" && mkdir -p \"$REMOTE_DIR\" && tar -xzf - -C \"$REMOTE_DIR\""

Start The Android Emulator

Connect to the host and start the Android emulator if no Android device is already connected.

ssh toki@toki-labs.com

export PATH="$HOME/SDK/flutter/bin:$HOME/Library/Android/sdk/emulator:$HOME/Library/Android/sdk/platform-tools:$HOME/Library/Android/sdk/cmdline-tools/latest/bin:$PATH"
export ANDROID_HOME="$HOME/Library/Android/sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"

flutter emulators
flutter emulators --launch Pixel_6_Pro_API_34

For non-interactive sessions, a headless launch also works:

nohup emulator -avd Pixel_6_Pro_API_34 -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect > "$HOME/tmp/pixel6pro-api34-emulator.log" 2>&1 &

Wait until the emulator is ready:

adb wait-for-device
until [ "$(adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" = "1" ]; do sleep 2; done
adb devices

Run The Checks

Run the deterministic Flutter checks:

cd "$HOME/tmp/nexo-codex-test/packages/messaging_flutter"
flutter analyze
flutter test

cd "$HOME/tmp/nexo-codex-test/apps/flutter-test"
flutter analyze
flutter test
flutter test integration_test -d emulator-5554

Run Android Gradle unit tests:

cd "$HOME/tmp/nexo-codex-test/apps/flutter-test/android"
./gradlew testDebugUnitTest

Interpreting Results

  • flutter test integration_test -d emulator-5554 verifies plugin registration, method-channel calls, EventChannel delivery, and opened-routing through the Android host app.
  • ./gradlew testDebugUnitTest verifies the Android unit-test layer and proves the Android SDK path is usable.
  • Real Firebase FCM delivery, nexo server ACK delivery, inline reply, and dismiss behavior remain manual smoke checks because they require external service configuration.