99 lines
2.7 KiB
Markdown
99 lines
2.7 KiB
Markdown
# Android Build Guide for Antigravity
|
|
|
|
## Prerequisites
|
|
|
|
### System Requirements
|
|
- Android SDK with API Level 34 (Android 14)
|
|
- Java Development Kit (JDK) 17 or higher
|
|
- Gradle 8.4 or higher
|
|
- Minimum 8GB RAM for builds
|
|
- Stable internet connection for dependency downloads
|
|
|
|
## Quick Build
|
|
|
|
### 1. Environment Setup
|
|
|
|
```bash
|
|
# Set environment variables
|
|
export ANDROID_HOME=/path/to/android-sdk
|
|
export JAVA_HOME=/path/to/jdk-17
|
|
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
|
|
```
|
|
|
|
### 2. Install Android SDK
|
|
|
|
If you don't have Android SDK installed:
|
|
|
|
```bash
|
|
# Download Android command-line tools
|
|
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
|
unzip commandlinetools-linux-11076708_latest.zip
|
|
mkdir -p $ANDROID_HOME/cmdline-tools/latest
|
|
mv cmdline-tools/* $ANDROID_HOME/cmdline-tools/latest/
|
|
|
|
# Accept licenses and install required components
|
|
yes | sdkmanager --licenses
|
|
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"
|
|
```
|
|
|
|
### 3. Build Commands
|
|
|
|
```bash
|
|
cd android-app/android
|
|
|
|
# Clean previous builds
|
|
rm -rf .gradle build app/build
|
|
|
|
# Build debug APK
|
|
./gradlew assembleDebug
|
|
|
|
# APK will be at: app/build/outputs/apk/debug/app-debug.apk
|
|
```
|
|
|
|
## Alternative: Manual APK Build
|
|
|
|
If Gradle doesn't work, you can build manually using Android SDK tools:
|
|
|
|
### Download Dependencies
|
|
|
|
Download these AAR files:
|
|
- androidx.appcompat:appcompat:1.6.1
|
|
- androidx.core:core:1.12.0
|
|
- androidx.activity:activity:1.8.2
|
|
- androidx.fragment:fragment:1.6.2
|
|
- androidx.webkit:webkit:1.10.0
|
|
|
|
### Manual Build Steps
|
|
|
|
1. Compile resources: `aapt2 compile --dir src/main/res -o build/resources.zip`
|
|
2. Package APK: `aapt package -f -F app-unsigned.apk -A src/main/assets -S src/main/res -I android.jar AndroidManifest.xml`
|
|
3. Compile Java: `javac -cp android.jar -d build/classes src/**/*.java`
|
|
4. Convert to DEX: `d8 build/classes.jar --output build`
|
|
5. Add DEX to APK: `aapt add app-unsigned.apk classes.dex`
|
|
6. Sign APK: `apksigner sign --ks release.keystore --out app.apk app-unsigned.apk`
|
|
|
|
## APK Output
|
|
|
|
- **Debug APK**: `android-app/android/app/build/outputs/apk/debug/app-debug.apk`
|
|
- **Release APK**: `android-app/android/app/build/outputs/apk/release/app-release-unsigned.apk`
|
|
|
|
## Troubleshooting
|
|
|
|
### Network Issues
|
|
If Gradle cannot download dependencies:
|
|
1. Use a VPN or proxy
|
|
2. Configure alternative Maven mirrors in `build.gradle`
|
|
3. Download dependencies manually and add to local Maven repository
|
|
|
|
### Memory Issues
|
|
If build runs out of memory:
|
|
```bash
|
|
export GRADLE_OPTS="-Xmx4g -XX:MaxMetaspaceSize=1g"
|
|
```
|
|
|
|
### Java Version Issues
|
|
Android Gradle Plugin 8.x requires JDK 17+. Use:
|
|
```bash
|
|
export JAVA_HOME=/path/to/jdk-17
|
|
```
|