App setup - Momentic

Momentic Android App Setup Documentation

Momentic supports Android apps running on local and remote emulators. Real devices are not supported.

Prerequisites

For remote emulators:

Remote emulators connect through a local adb tunnel, so adb is required even though the emulator itself runs on Momentic’s infrastructure. Only the platform-tools are needed: Android Studio, Java, and a local emulator image are not.

adb on your PATH alone is not enough. Export ANDROID_HOME as well, or the run fails at driver startup with Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported.

For local emulators, add:

Install Node.js

Download from nodejs.org.

node -v  # 22.12.0+ in 22.x, or 24.0.0+; Node.js 23 is unsupported

Install adb

Download the Android SDK platform-tools and unzip them into an SDK directory, then export ANDROID_HOME at that directory (not at platform-tools itself):

mkdir -p "$HOME/Android/sdk"
unzip platform-tools-latest-darwin.zip -d "$HOME/Android/sdk" # or -linux / -windows
echo 'export ANDROID_HOME="$HOME/Android/sdk"' >> ~/.zshrc
echo 'export PATH="$ANDROID_HOME/platform-tools:$PATH"' >> ~/.zshrc
source ~/.zshrc
adb --version

If you already have Android Studio, platform-tools come with its SDK; export ANDROID_HOME at that SDK instead (see Set ANDROID_HOME).

brew install --cask android-platform-tools puts adb on your PATH but creates no SDK directory, so ANDROID_HOME has nothing valid to point at. Use the zip above, or pair the cask with an SDK layout.

Install Java

Java is only needed for local emulators. Download JDK 24 from Oracle.

java --version  # JDK 24

If java --version isn’t found, re-open your terminal or make sure JAVA_HOME/bin is on your PATH.

Install Android Studio

Android Studio is only needed for local emulators. Download Android Studio and complete the first-run setup. Include:

Set ANDROID_HOME

Point ANDROID_HOME at your Android SDK install. (ANDROID_SDK_ROOT works too if your setup already exports it.) Typical locations:

# macOS (zsh)
echo 'export ANDROID_HOME="$HOME/Library/Android/sdk"' >> ~/.zshrc
echo 'export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$PATH"' >> ~/.zshrc
source ~/.zshrc

# Linux (bash/zsh)
echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> ~/.bashrc
echo 'export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$PATH"' >> ~/.bashrc
source ~/.bashrc

Follow the official guide to set ANDROID_HOME in System Properties, then restart your shell.

Verify

node -v              # 22.12.0+ in 22.x, or 24.0.0+; Node.js 23 is unsupported
adb --version        # required for remote and local emulators
echo $ANDROID_HOME   # or ANDROID_SDK_ROOT: must print an SDK directory
java --version       # JDK 24, local emulators only

Enable WebView Debugging

If your app renders content inside an Android WebView, enable WebView debugging so Momentic can attach and interact with elements inside the WebView. Add this to your app’s startup code, before the WebView is used:

WebView.setWebContentsDebuggingEnabled(true);

Without this, interactions against WebView elements fail with InternalWebAgentError: No browser controller is attached to the requested webview.

Build Your APK

Build a debug or release APK from the Gradle project root:

./gradlew assembleRelease

Gradle writes the APK to app/build/outputs/apk/release/.

Cross-Platform Frameworks

Momentic tests the native build, so React Native, Expo, Flutter, and other frameworks need no extra setup:

APK Requirements

Next Steps