Skip to main content
This guide covers building Off Grid from source, including prerequisites, setup, and platform-specific build commands.

Prerequisites

1

Node.js 20+

Off Grid requires Node.js 20 or higher. Install from nodejs.org or use a version manager like nvm.
node --version  # Should be 20.x or higher
2

React Native CLI

Install the React Native CLI globally:
npm install -g react-native-cli
3

Platform-Specific Tools

Install the required tools for your target platform:
  • JDK 17 - Java Development Kit (Temurin/Adoptium recommended)
  • Android SDK (API 36) - Install via Android Studio
  • Android NDK r27 - Required for native module compilation
  • Android Studio - Recommended for device emulation and debugging
Verify your setup:
java -version      # Should be 17.x
echo $ANDROID_HOME # Should point to Android SDK

Clone and Install

1

Clone the repository

git clone https://github.com/alichherawalla/off-grid-mobile.git
cd off-grid-mobile
2

Install JavaScript dependencies

npm install
This installs all React Native and JavaScript dependencies defined in package.json.
3

Platform setup

cd android
./gradlew clean
cd ..
This cleans the Gradle build cache and prepares the Android project.

Development Builds

Start Metro Bundler

First, start the Metro bundler in a terminal:
npm start
Leave this running and open a new terminal for platform-specific commands.

Android

npm run android
This launches the app on a connected Android device or emulator.
Make sure you have a device connected via ADB or an emulator running before executing the build command.

iOS

npm run ios
Always open OffgridMobile.xcworkspace, not OffgridMobile.xcodeproj. The workspace includes CocoaPods dependencies.

Release Builds

Android

1

Create keystore (first time only)

keytool -genkeypair -v -storetype PKCS12 -keystore my-release-key.keystore \
  -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Store the keystore file in a secure location (not in the repository).
2

Configure signing

Create or edit android/gradle.properties:
android/gradle.properties
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=your_keystore_password
MYAPP_RELEASE_KEY_PASSWORD=your_key_password
Never commit gradle.properties with credentials to version control. Add it to .gitignore.
3

Build the release APK

cd android
./gradlew assembleRelease
The signed APK will be at:
android/app/build/outputs/apk/release/app-release.apk

iOS

1

Open Xcode

open ios/OffgridMobile.xcworkspace
2

Archive the build

  1. Select ProductArchive
  2. Wait for the archive to complete
  3. The Organizer window will open automatically
3

Distribute the app

  1. Select your archive
  2. Click Distribute App
  3. Choose distribution method:
    • App Store Connect - For App Store submission
    • Ad Hoc - For TestFlight or direct distribution
    • Development - For local testing
  4. Follow the signing and provisioning workflow

Troubleshooting

Android Build Errors

Clear the Gradle cache and rebuild:
cd android
./gradlew clean
./gradlew assembleDebug --rerun-tasks
Install the NDK via Android Studio:
  1. Open ToolsSDK Manager
  2. Select SDK Tools tab
  3. Check NDK (Side by side)
  4. Click Apply to install
Edit android/build.gradle and ensure buildToolsVersion matches your installed version:
buildToolsVersion = "34.0.0"

iOS Build Errors

Clean and reinstall pods:
cd ios
rm -rf Pods Podfile.lock
pod install
cd ..
  1. Open OffgridMobile.xcworkspace in Xcode
  2. Select the project in the navigator
  3. Go to Signing & Capabilities
  4. Select your Team (requires Apple Developer account)
  5. Xcode will automatically manage provisioning profiles
This usually means the device is locked. Unlock your device and try again.

Next Steps

Project Structure

Learn how the codebase is organized

Testing Guide

Run tests and understand the testing strategy

Contributing

Learn the contribution workflow and quality gates

Build docs developers (and LLMs) love