scar-chat/android_client/BUILD_QUICK_REF.md

105 lines
2.6 KiB
Markdown
Raw Normal View History

# Android Build - Quick Reference Card
## ✅ One-Line Build (After Setup)
```bash
cd android_client && ./gradlew build
```
## 📋 Pre-Build Checklist
- [ ] Java installed: `java -version` (need 11+)
- [ ] Android SDK installed (via Android Studio)
- [ ] ANDROID_HOME set: `echo $ANDROID_HOME`
- [ ] Gradle wrapper present: `ls android_client/gradlew`
## 🚀 Build Commands
| Task | Linux/macOS | Windows |
|------|------------|---------|
| Build APK | `./gradlew build` | `gradlew.bat build` |
| Debug APK only | `./gradlew assembleDebug` | `gradlew.bat assembleDebug` |
| Install to device | `./gradlew installDebug` | `gradlew.bat installDebug` |
| Release APK | `./gradlew assembleRelease` | `gradlew.bat assembleRelease` |
| Clean build | `./gradlew clean build` | `gradlew.bat clean build` |
## 📍 APK Locations After Build
```
android_client/
└── app/build/outputs/apk/
├── debug/app-debug.apk (8-10 MB)
└── release/app-release.apk (5-6 MB)
```
## 🔧 Troubleshooting 2-Minute Fixes
**"./gradlew: permission denied"**
```bash
chmod +x android_client/gradlew
./gradlew build
```
**"gradle: command not found"**
```bash
cd android_client
./gradlew build # Uses embedded gradle
```
**"ANDROID_HOME not set"**
```bash
export ANDROID_HOME=$HOME/Android/Sdk # Linux/macOS
# or
$env:ANDROID_HOME = "$env:USERPROFILE\AppData\Local\Android\Sdk" # Windows
./gradlew build
```
**"Java not found"**
```bash
# Install Java 11+
# Linux: sudo apt-get install openjdk-11-jdk
# macOS: brew install java@11
# Windows: https://adoptopenjdk.net/
java -version # Verify
./gradlew build
```
**"Build fails - need SDK components"**
```bash
# Let Android Studio download missing components
# Android Studio → Tools → SDK Manager → Install missing packages
# Then retry build
./gradlew clean build
```
## 📊 Build Times
- **First build**: 5-15 minutes (downloads 500+ MB)
- **Incremental build**: 30 seconds - 2 minutes
- **Clean build**: 2-5 minutes
## 📚 Documentation
- **For setup**: See `SETUP_GUIDE.md`
- **For usage**: See `README.md`
- **For tech details**: See `../ANDROID_IMPLEMENTATION.md`
## ✨ Working Gradle Wrapper
**Gradle wrapper is now included!**
- Linux/macOS: `./gradlew` ← Use this
- Windows: `gradlew.bat` ← Use this
- No separate Gradle installation needed
## 🎯 Next Steps
1. **Build**: `cd android_client && ./gradlew build`
2. **Install**: `./gradlew installDebug` (if device connected)
3. **Run**: Open SCAR Chat app on device
---
**Last Updated**: December 4, 2025
**Status**: ✅ Gradle wrapper included and working