Skip to content

Build and run the app

Edouard Marquez edited this page Mar 30, 2023 · 2 revisions

Smooth-App is the official mobile application for Open Food Facts, which relies on Flutter's framework.

Requirements

To build the application, we currently depend on the latest stable version of Flutter (3.7.x as of writing this article). You can download and install the framework, by following the instructions on the official website.

The application only - and officially - supports Android and iOS (whereas Flutter supports both web and desktop).

How to build the app?

Some background

The application can be deployed on multiple stores:

  • iOS: only the App Store
  • Android: Google Play, F-Droid, Huawei AppGallery and Samsung Gallery

Entry points

Each store has its own configuration to use a different barcode scanning engine and a way to rate the app, that's why you have multiple entry points :

  • packages/smooth_app/lib/entrypoints/ios/main_ios.dart to deploy on the App Store
  • packages/smooth_app/lib/entrypoints/android/main_amazon_appstore.dart to deploy on the Amazon Appstore
  • packages/smooth_app/lib/entrypoints/android/main_fdroid.dart to deploy on F-Droid
  • packages/smooth_app/lib/entrypoints/android/main_google_play.dart to deploy on the Google Play
  • packages/smooth_app/lib/entrypoints/android/main_huawei_appgallery.dart to deploy on the Huawei AppGallery
  • packages/smooth_app/lib/entrypoints/android/main_samsung_gallery.dart to deploy on the Samsung Gallery

From an IDE

With IntelliJ IDEA

At the top of the screen, you have multiple Run configurations available, which link to the correct store/platform you want to test:

From the command line

  1. Move to the packages/smooth_app directory
  2. Run the flutter pub get command to fetch the dependencies
  3. Run the flutter run -t [path/to/the/entrypoint.dart] command to build and then launch the application in debug mode

For example, on iOS, the command is: flutter run -t packages/smooth_app/lib/entrypoints/ios/main_ios.dart

Common errors

Error running pod install

When you run the flutter run command with an iOS device or simulator and if you have this kind of error:

Error: CocoaPods's specs repository is too out-of-date to satisfy
dependencies.
To update the CocoaPods specs, run:
  pod repo update



Error running pod install
Error launching application on iPhone 14 Pro.

In that case, you simply need to:

  1. Move to the ios folder (within packages/smooth_app/)
  2. Run the pod update command
  3. Go back to the main folder and re-run flutter run