# Setup Build Environment The Android app is ready to build! You just need to install Java first. ## Install Java 17 ### Option 1: Via Windows (Recommended for WSL) Download and install Java 17 JDK for Windows, then WSL can use it: 1. **Download Oracle JDK 17:** - https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html - Or OpenJDK: https://adoptium.net/temurin/releases/?version=17 2. **Install on Windows** 3. **Add to WSL PATH:** ```bash # Add to ~/.bashrc echo 'export JAVA_HOME="/mnt/c/Program Files/Java/jdk-17"' >> ~/.bashrc echo 'export PATH="$JAVA_HOME/bin:$PATH"' >> ~/.bashrc source ~/.bashrc # Verify java -version ``` ### Option 2: SDKMAN (Linux-native) ```bash # Install SDKMAN curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" # Install Java 17 sdk install java 17.0.9-tem # Verify java -version ``` --- ## Build the App Once Java is installed: ```bash cd ~/.openclaw/workspace/alfred-mobile # First build (downloads Android SDK, takes 5-10 min) ./gradlew assembleDebug # Output app/build/outputs/apk/debug/app-debug.apk ``` --- ## Install on Tablet ### Method 1: ADB (USB) ```bash # Enable USB debugging on tablet: # Settings → About → Tap "Build number" 7 times # Settings → Developer options → USB debugging → ON # Connect tablet via USB adb devices # If device not found: # - Allow USB debugging on tablet # - Try different USB cable/port # Install adb install app/build/outputs/apk/debug/app-debug.apk # Or reinstall if already installed adb install -r app/build/outputs/apk/debug/app-debug.apk ``` ### Method 2: Direct Install 1. Copy APK to tablet: ```bash # Via ADB adb push app/build/outputs/apk/debug/app-debug.apk /sdcard/Download/ # Or use file sharing, email, etc. ``` 2. On tablet: - Open Files app → Downloads - Tap `app-debug.apk` - Allow "Install from unknown sources" if prompted - Tap "Install" --- ## Test OAuth Flow See `BUILD_STATUS.md` for testing instructions. --- ## Troubleshooting ### "No Java runtime present" Java not installed or not in PATH. Follow instructions above. ### "SDK location not found" Gradle will auto-download Android SDK on first build. Just wait. ### "Build failed" ```bash # Clean and rebuild ./gradlew clean assembleDebug # Check logs ./gradlew assembleDebug --stacktrace ``` ### "Could not HEAD 'https://dl.google.com/...'" Network issue. Check internet connection and retry. --- Once Java is installed, run: ```bash cd ~/.openclaw/workspace/alfred-mobile ./gradlew assembleDebug ``` Then install on your tablet and test! 🚀