How to compile and run an Android app on an emulator/device

Run on a device:

  1. Connect the device to the computer using a cable.
  2. Enable developer mode on the device:
    • Go to Settings About Phone.
    • Find the Build Number entry and tap it repeatedly until prompted to enter a password.
    • After entering the password, developer mode will be enabled.
      For Xiaomi devices: Settings About Phone. Tap 5-7 times on MIUI Version until a window appears confirming that the developer mode is enabled.
  3. Return to the Android Studio.
  4. Open the terminal and enter the command: ./gradlew parseConfig.
  5. Press Cmd/Ctrl + Enter (repeat this command each time you make changes to the project, including when working with the app_config.json file).
  6. Press ▶ Run. 

The application is built, and you can view it on the device. It is important that "app" is selected in Run Configurations, as shown in the screenshot below:

Run on an emulator:

  1. Go to Device Manager → Create Virtual Device.
  2. Add any of the suggested devices, making sure it has Android OS version 8 or higher.
  3. Launch Android Studio.
  4. Open the terminal and enter the command: ./gradlew parseConfig.
  5. Press Cmd/Ctrl + Enter (repeat this command each time you make changes to the project, including when working with the configuration file, to apply these changes to the build).
  6. Press ▶ Run.
    The application is built, and you can view it on the emulator. It is important that "app" is selected in "Run Configurations," as shown in the screenshot below:

How to build a debug (test) or release (published to the store) build:

  1. Go to Build Select Build Variant.
  2. Change debug to release or vice versa. By default, debug is used for all builds.s.
  3. Press "▶ Run."