Prerequisites
Before you begin, ensure you have the following installed:Android Studio
Version 3.1.4 or higher
Java Development Kit
JDK 8 or higher
Android SDK
API Level 22 (Lollipop) minimum
Firebase Account
Free tier is sufficient
Step 1: Install Android Studio
Download Android Studio
Download Android Studio from the official website.
The Sales Management App uses Android Studio 3.1.4 with Gradle 3.1.4. Newer versions should work but may require dependency updates.
Install SDK Components
Launch Android Studio and install the following SDK components:
- Android SDK Platform 26 (Oreo)
- Android SDK Build-Tools 27.0.3
- Android Support Repository
- Google Repository
Step 2: Configure Gradle Dependencies
The project uses specific Gradle configurations. Here’s the complete setup:Project-Level build.gradle
Key Dependencies Explained
Firebase Suite (firebase-*)
Firebase Suite (firebase-*)
- firebase-core: Analytics and core Firebase functionality
- firebase-database: Real-time database for chat, inventory, and user data
- firebase-storage: Cloud storage for profile images and attachments
- firebase-auth: Email/password authentication
- firebase-ui-storage: UI components for Firebase Storage
MPAndroidChart
MPAndroidChart
Powerful charting library used for:
- Line graphs showing salesperson progress over time
- Pie charts for manager profit analysis
- Customizable chart styling and animations
Glide
Glide
Image loading and caching library with automatic:
- Image compression before Firebase upload
- Memory and disk caching
- Placeholder and error image handling
SwipeMenuListView
SwipeMenuListView
Step 3: Firebase Configuration
Firebase powers authentication, database, and storage. Follow these steps to set up your Firebase project:Create Firebase Project
- Go to Firebase Console
- Click Add Project
- Enter project name (e.g., “sales-management-app”)
- Accept terms and click Create Project
Add Android App
In your Firebase project:
- Click the Android icon to add an Android app
- Enter package name:
project.avishkar.salesmanagement - (Optional) Add app nickname: “Sales Management”
- Click Register App
The package name must match exactly as defined in
app/build.gradle’s applicationId.Download google-services.json
- Download the
google-services.jsonfile - Place it in your project’s
app/directory:
Enable Authentication
In Firebase Console, navigate to Authentication > Sign-in method:
- Click Email/Password
- Enable both toggles:
- Email/Password
- Email link (passwordless sign-in)
- Click Save
MainActivity.java:126
Set Up Realtime Database
Navigate to Database > Realtime Database:
- Click Create Database
- Choose location (e.g., us-central1)
- Start in Test Mode for development
- Click Enable
Step 4: Repository Setup
The project requires JitPack and Maven Central for third-party libraries:Step 5: Verify Installation
Run these commands to verify everything is set up correctly:Troubleshooting
Gradle Sync Failed
Gradle Sync Failed
Problem: “Failed to resolve: com.google.firebase:firebase-core:16.0.1”Solution:
google-services.json Not Found
google-services.json Not Found
Problem: “File google-services.json is missing”Solution:
- Ensure file is in
app/directory (not root) - Check filename is exactly
google-services.json - Verify package name matches Firebase configuration
Build Tools Version Mismatch
Build Tools Version Mismatch
Problem: “Failed to find Build Tools revision 27.0.3”Solution:
Minimum SDK Version Error
Minimum SDK Version Error
Problem: Device API level too lowSolution:
The app requires API 22 (Android 5.1) minimum. Use an emulator or device with Android 5.1 or higher.
Next Steps
Quick Start Guide
Now that your environment is configured, learn how to clone the repository and run the app for the first time.