Skip to main content

Mobile App Setup

This guide will help you set up the ThePlugg mobile app for development.

Prerequisites

  • Flutter SDK (latest stable version)
  • Dart SDK (comes with Flutter)
  • Xcode (for iOS development on macOS)
  • Android Studio (for Android development)
  • Physical device or emulator/simulator

Installation

  1. Install Flutter

Follow the official Flutter installation guide: https://flutter.dev/docs/get-started/install

Verify installation:

flutter doctor
  1. Clone and navigate to project
cd ThePlugg-app
  1. Get dependencies
flutter pub get
  1. Configure API endpoint

Edit lib/config/api_config.dart and update the base URL:

static const String baseUrl = 'http://localhost:3000';
// or production: 'https://api.thepluggnamibia.com'
  1. Configure Firebase (if using)

The app uses Firebase for:

  • Authentication
  • Push notifications (via OneSignal)

Set up Firebase projects for iOS and Android and add configuration files:

  • ios/Runner/GoogleService-Info.plist (iOS)
  • android/app/google-services.json (Android)
  1. iOS Setup
cd ios
pod install
cd ..
  1. Run the app
# List available devices
flutter devices

# Run on iOS
flutter run -d ios

# Run on Android
flutter run -d android

Environment Configuration

The app uses hardcoded configuration in lib/config/api_config.dart. For different environments, you can:

  1. Create environment-specific config files
  2. Use environment variables
  3. Use build flavors

Testing

Run tests:

flutter test

Building

iOS

flutter build ios

Android

flutter build apk
# or for app bundle
flutter build appbundle

Troubleshooting

iOS Issues

  • Run pod install in ios/ directory
  • Clean build: flutter clean && flutter pub get
  • Check Xcode version compatibility

Android Issues

  • Check Android SDK installation
  • Verify android/local.properties has correct SDK path
  • Clean build: flutter clean && flutter pub get

Common Errors

  • Missing dependencies: Run flutter pub get
  • Build errors: Run flutter clean and rebuild
  • API connection: Check network and API endpoint configuration