Files
alfred-mobile/BUILD_INSTRUCTIONS.md
jknapp 6d4ae2e5c3 Initial commit: Alfred Mobile - AI Assistant Android App
- OAuth authentication via Authentik
- WebSocket connection to OpenClaw gateway
- Configurable gateway URL with first-run setup
- User preferences sync across devices
- Multi-user support with custom assistant names
- ElevenLabs TTS integration (local + remote)
- FCM push notifications for alarms
- Voice input via Google Speech API
- No hardcoded secrets or internal IPs in tracked files
2026-02-09 11:12:51 -08:00

4.8 KiB

Alfred Mobile - Build Instructions

Quick Start

Environment Variables

Before building, set these environment variables:

export JAVA_HOME=~/android-dev/jdk-17.0.2
export ANDROID_HOME=~/android-dev/android-sdk
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH

Build Commands

# Navigate to project
cd ~/.openclaw/workspace/alfred-mobile

# List available tasks
./gradlew tasks

# Build debug APK
./gradlew assembleDebug

# Build release APK (requires signing config)
./gradlew assembleRelease

# Run unit tests
./gradlew test

# Clean build
./gradlew clean

# Check project dependencies
./gradlew dependencies

Build Output

Debug APK will be located at:

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

Release APK will be located at:

app/build/outputs/apk/release/app-release-unsigned.apk

Installing on Device

Via ADB (Android Debug Bridge)

# List connected devices
adb devices

# Install debug APK
adb install app/build/outputs/apk/debug/app-debug.apk

# Or use Gradle
./gradlew installDebug

# Uninstall
adb uninstall com.openclaw.alfred

Development on Windows

If you prefer to use Android Studio on Windows:

  1. Install Android Studio from https://developer.android.com/studio

  2. Clone the repository (in Windows, not WSL):

    cd C:\Development
    git clone https://repo.anhonesthost.net/jknapp/alfred-mobile.git
    
  3. Open in Android Studio:

    • File → Open → Select alfred-mobile folder
    • Wait for Gradle sync to complete
    • Click Run button or press Shift+F10
  4. Configure emulator (if needed):

    • Tools → Device Manager
    • Create Virtual Device
    • Select a device definition (e.g., Pixel 6)
    • Download system image (API 34 recommended)
    • Launch emulator

Troubleshooting

Gradle Daemon Issues

# Stop all Gradle daemons
./gradlew --stop

# Clean and rebuild
./gradlew clean build

SDK License Issues

export ANDROID_HOME=~/android-dev/android-sdk
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses

Java Version Issues

# Verify Java version (should be 17)
java -version

# If wrong version, ensure JAVA_HOME is set correctly
export JAVA_HOME=~/android-dev/jdk-17.0.2

Missing Dependencies

# Update SDK components
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"

IDE Configuration

Android Studio Preferences

Gradle JDK: Set to Java 17

  • File → Settings → Build → Build Tools → Gradle
  • Gradle JDK: Select Java 17

Kotlin Plugin: Ensure version 1.9.20 or compatible

Code Style: Kotlin official style guide

Testing

Running Tests

# Run all tests
./gradlew test

# Run specific test class
./gradlew test --tests com.openclaw.alfred.ExampleTest

# Run tests with coverage
./gradlew testDebugUnitTestCoverage

UI Tests (Android Instrumentation)

# Ensure device/emulator is running
adb devices

# Run instrumentation tests
./gradlew connectedAndroidTest

Signing Configuration (Production)

For release builds, create keystore.properties in the project root:

storeFile=/path/to/keystore.jks
storePassword=your_store_password
keyAlias=your_key_alias
keyPassword=your_key_password

Then update app/build.gradle.kts to load signing config.

Continuous Integration

GitHub Actions / GitLab CI Example

build:
  image: openjdk:17-jdk
  before_script:
    - wget -q https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
    - unzip -q commandlinetools-linux-9477386_latest.zip
    - yes | cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses
    - cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME "platform-tools" "platforms;android-34" "build-tools;34.0.0"
  script:
    - ./gradlew assembleDebug
    - ./gradlew test
  artifacts:
    paths:
      - app/build/outputs/apk/debug/app-debug.apk

Performance Optimization

Build Performance

Add to gradle.properties:

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
kotlin.incremental=true

APK Size Reduction

  • Enable ProGuard/R8 in release builds (already configured)
  • Use APK Analyzer: Build → Analyze APK... in Android Studio
  • Enable resource shrinking in app/build.gradle.kts

Additional Resources


Note: This project is currently in Phase 1 (scaffold complete). Phase 2 will add OpenClaw integration.