LifeFlow/BUILD.md

188 lines
3.1 KiB
Markdown

# Building LifeFlow APK
This guide explains how to build the LifeFlow Android APK.
## Prerequisites
- Linux/macOS/Windows with bash
- Git
- 10GB free disk space
## Step-by-Step Build Instructions
### 1. Clone Repository
```bash
git clone https://git.lemonlink.eu/impulsivefps/LifeFlow.git
cd LifeFlow
```
### 2. Install Flutter SDK
#### Option A: Using the provided script (Linux/macOS)
```bash
bash scripts/install_flutter.sh
source ~/.bashrc
flutter doctor
```
#### Option B: Manual Installation
1. Download Flutter from: https://docs.flutter.dev/get-started/install
2. Extract to a location (e.g., `/opt/flutter` or `C:\flutter`)
3. Add to PATH:
```bash
# Linux/macOS - add to ~/.bashrc or ~/.zshrc
export PATH="$PATH:/opt/flutter/bin"
# Windows - add to System Environment Variables
C:\flutter\bin
```
### 3. Verify Installation
```bash
flutter doctor
```
You should see checkmarks for:
- [✓] Flutter (Channel stable)
- [✓] Android toolchain
- [✓] Android Studio (optional but recommended)
### 4. Get Dependencies
```bash
cd android
flutter pub get
```
### 5. Build APK
#### Debug APK (for testing)
```bash
flutter build apk --debug
```
Output: `build/app/outputs/flutter-apk/app-debug.apk`
#### Release APK (for distribution)
```bash
flutter build apk --release
```
Output: `build/app/outputs/flutter-apk/app-release.apk`
### 6. Install on Device
#### Option A: USB Installation
1. Connect Android device with USB debugging enabled
2. Run:
```bash
flutter install
```
#### Option B: Manual Installation
1. Copy APK to device
2. Open file manager on device
3. Tap APK to install (may need to allow "Unknown Sources")
---
## Troubleshooting
### "flutter: command not found"
**Solution:** Flutter not in PATH
```bash
export PATH="$PATH:/opt/flutter/bin"
# Or wherever you installed Flutter
```
### "Android SDK not found"
**Solution:** Install Android Studio or Android SDK Command Line Tools
```bash
# Download from: https://developer.android.com/studio
# Or use sdkmanager
```
### "Gradle build failed"
**Solution:** Clean and rebuild
```bash
flutter clean
flutter pub get
flutter build apk --release
```
### "Out of memory"
**Solution:** Increase heap size
```bash
export GRADLE_OPTS="-Xmx4g"
flutter build apk --release
```
---
## Build for Other Platforms
### Windows
```bash
flutter build windows --release
```
Output: `build/windows/x64/runner/Release/`
### Linux
```bash
flutter build linux --release
```
Output: `build/linux/x64/release/bundle/`
### macOS
```bash
flutter build macos --release
```
Output: `build/macos/Build/Products/Release/`
---
## Automated Build (CI/CD)
For GitHub Actions automated builds, see `.github/workflows/` (to be added).
---
## APK Size Optimization
The default release APK includes debug symbols. To create a smaller APK:
```bash
flutter build apk --release --split-debug-info=symbols
```
Or build an App Bundle (recommended for Play Store):
```bash
flutter build appbundle --release
```
---
## Need Help?
- Check Flutter documentation: https://docs.flutter.dev
- Open an issue: https://git.lemonlink.eu/impulsivefps/LifeFlow/issues