Skip to content

Latest commit

 

History

History
262 lines (192 loc) · 4.75 KB

File metadata and controls

262 lines (192 loc) · 4.75 KB

BabyNest Setup Guide

This guide provides step-by-step instructions to set up the BabyNest app for Android and iOS, addressing platform-specific dependencies and configurations.

Prerequisites

Ensure you have the following installed:

  • Node.js (Latest LTS version)
  • React Native CLI
  • Python 3.8+ (For Flask backend)
  • SQLite (For local storage)
  • ChromaDB (For vector search)
  • Git (For version control)

1) Clone the Repository

git clone https://github.com/AOSSIE-Org/BabyNest.git
cd BabyNest

Android Setup

2) Install Dependencies

cd Frontend
npm install

3) Set Up Android Development Environment

  • Install Android Studio and ensure the latest SDK versions are installed.
  • Set up an Android Virtual Device (AVD) or connect a physical device.
  • Ensure ANDROID_HOME is set in your environment variables. Install dependencies:
    npx react-native doctor
  • If needed, install missing dependencies.

4. Configure SQLite

BabyNest uses SQLite for local storage: Ensure react-native-sqlite-storage is installed:

npm install react-native-sqlite-storage

Link dependencies (if necessary):

npx pod-install

5) Run the App on Android

npx react-native start
npx react-native run-android

iOS Setup

2) Install Dependencies

cd Frontend
npm install

3) Set Up iOS Development Environment

  • Install Xcode from the Mac App Store. Install CocoaPods (if not installed):
    sudo gem install cocoapods

Install pods:

cd ios
pod install
cd ..
  • Set up a simulator or use a physical device.

4. Configure SQLite

BabyNest uses SQLite for local storage: Ensure react-native-sqlite-storage is installed:

npm install react-native-sqlite-storage

Link dependencies:

npx pod-install

5) Run the App on iOS

npx react-native start
npx react-native run-ios

Backend Setup (Offline Flask API)

BabyNest includes an offline backend using Flask

6) Install Python Dependencies

cd Backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

7) Run the Backend Locally

cd Backend

For Development Mode:

python app.py --env development

This will start the API locally in development mode. In development mode, error messages are more detailed and verbose, making it easier to debug issues during development.

For Production Mode:

python app.py --env production

This will start the API in production mode. In production mode, error messages are more general and details are minimized for security purposes.


Handling Vector Search (ChromaDB)

BabyNest uses ChromaDB for offline vector search.

1) Install ChromaDB

pip install chromadb

2) Run ChromaDB

python -m chromadb

This starts the local vector database.


Troubleshooting

Android Issues

  • If run-android fails, ensure:
    • Emulator or physical device is connected.
    • adb devices lists a device.
    • npx react-native start is running.
  • If you encounter a Java heap space error, increase heap size:
    export NODE_OPTIONS=--max_old_space_size=4096
  • If build fails with Gradle errors, try:
    cd android
    ./gradlew clean
    cd ..

iOS Issues

  • Try uninstalling any app in ios simulator and close the terminal and run all the commands again as mentioned here.

  • If the issues still persist and build fails, try:

    cd ios
    pod install --verbose
    cd ..
  • Ensure Xcode command-line tools are installed:

    sudo xcode-select --install
  • If the Metro bundler crashes, clear the cache:

    npx react-native start --reset-cache
  • If CocoaPods fails with dependency issues, try:

    cd ios
    pod repo update
    pod install --verbose
    cd ..
  • If you encounter Podfile.lock conflicts, remove and reinstall pods:

    cd ios
    rm -rf Pods Podfile.lock
    pod install
    cd ..
  • If linking issues occur, ensure dependencies are correctly linked:

    npx react-native link

Backend Issues

  • If Flask doesn’t start, check dependencies:
    cd Backend
    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
  • Ensure Python version is 3.8+.
  • If Flask crashes with Address already in use, free the port:
    lsof -i :5000
    kill -9 <PID>

Database Issues

  • If SQLite doesn’t initialize, ensure:
    • The database file exists in the correct directory.
    • Correct permissions are set:
      chmod 777 database.db

Conclusion

Once both the frontend and backend are running, BabyNest will be fully functional. For any issues, check logs and ensure dependencies are correctly installed.