# Android Setup Instructions
## Quick Start
### 1. Run the Setup Script
```bash
./scripts/setup-android.sh
```
This will:
- Install Android targets
- Set up Android NDK (if available)
- Build native libraries for all Android architectures
- Generate Kotlin bindings
- Create AAR structure
### 2. Build the AAR
```bash
./scripts/android/build-aar.sh
cd target/aar
./gradlew assembleRelease
```
### 3. Setup Android Studio Project
```bash
./scripts/android/setup-studio-project.sh
```
### 4. Open in Android Studio
```bash
cd android-example
# Open this directory in Android Studio
```
### 5. Build and Run
- Sync Gradle
- Build the project
- Run on emulator or device
## Alternative: Manual Setup
### 1. Install Prerequisites
```bash
# Install Android targets
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
# Install cargo-make if not already installed
cargo install cargo-make
```
### 2. Configure Android NDK
Download Android NDK and set environment variables:
```bash
export ANDROID_NDK_ROOT=/path/to/ndk
export PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
```
### 3. Build Native Libraries
```bash
# Build for each architecture
cargo build --target aarch64-linux-android --features uniffi --release
cargo build --target armv7-linux-androideabi --features uniffi --release
cargo build --target x86_64-linux-android --features uniffi --release
cargo build --target i686-linux-android --features uniffi --release
```
### 4. Create AAR Structure
Follow the build-aar.sh script manually or run it directly.
## Troubleshooting
### NDK Not Found
- Install Android NDK via Android Studio SDK Manager
- Set ANDROID_NDK_ROOT environment variable
- Ensure NDK toolchain is in PATH
### Build Failures
- Check Android NDK version compatibility
- Ensure all Android targets are installed
- Verify Cargo.toml configuration for Android
### Runtime Issues
- Check that AAR includes all native libraries
- Verify Android manifest permissions
- Test on different Android versions and architectures
## Next Steps
1. **Review the Code**: Examine the example app structure
2. **Understand the Integration**: Look at ProofModeManager and provider implementations
3. **Test Thoroughly**: Use both emulator and physical device testing
4. **Customize**: Adapt the example for your specific needs
The Android example app provides a complete working implementation that demonstrates all ProofMode functionality in a native Android environment.