Skip to main content

Run the mobile app

We provide a set of scripts to help you run the app for the different platforms that are executed with npm:

  • npm start: Start the React Native packager. The packager has to be running in order to build the JavaScript code that powers the app.
  • npm run android: Compile and run the mobile app on Android.
  • npm run ios: Compile and run the mobile app on iOS.

The above commands are shortcuts for the react-native CLI. You can append -- --help to the above commands to see available options, for example:

npm run android -- --help

Make sure you are adding -- before the options you want to include or run the react-native CLI directly:

npx react-native run-android --help

Run on a device

By default, running the app will launch an Android emulator (if you created one) or an iOS simulator.

If you want to test the performance of the app or if you want to make a contribution it is always a good idea to run the app on an actual device. This will let you ensure that the app is working correctly and in a performant way before submitting a pull request.

To be able to run the app on an Android device you'll need to follow these steps:

  1. Enable debugging over USB

    Most Android devices can only install and run apps downloaded from Google Play by default. In order to be able to install the Mattermost Mobile app in the device during development you will need to enable USB Debugging on your device in the Developer options menu by going to Settings > About phone and then tap the Build number row at the bottom seven times, then go back to Settings > Developer options and enable USB debugging.

  2. Plug in your device via USB

    Plug in your Android device in any available USB port in your development machine (try to avoid hubs and plug it directly into your computer) and check that your device is properly connecting to ADB (Android Debug Bridge) by running adb devices.

    $ adb devices
    List of devices attached
    42006fb3e4fb25b8 device

    If you see device in the right column that means that the device is connected. You can have multiple devices attached and the app will be deployed to all of them.

  3. Compile and run

    With your device connected to the USB port execute the following in your command prompt to install and launch the app on the device:

    npm run android