Filter by title
Document Options

There are multiple versions of this document. Pick the options that suit you best.

Architecture:

Running on a Device

You can use this guide when you want to run the app on an Android emulator, iOS simulator, or physical device instead of in the browser.

For browser testing, see Running on Web.

Prerequisites

  1. Install dependencies in the React Native project folder:
  • react-native/
  1. Complete the database migration and ensure the backend host is running.

  2. Set up an emulator or simulator if needed:

  3. Install cloudflared before using the MobileEmulator profile or yarn tunnel:api. Follow Cloudflare's Download and install cloudflared guide. The template uses free Quick Tunnels (*.trycloudflare.com) and does not require a Cloudflare account or the remaining locally-managed tunnel steps in that document.

Using ABP Studio

Pro, non-tiered Monolith solutions include a MobileEmulator run profile in the Solution Runner. When you start it, ABP Studio specifically runs:

  1. The backend host
  2. ReactNativeTunnel — runs node scripts/tunnel.js to expose your local backend through a Cloudflare tunnel
  3. ReactNative — runs npx expo start --android (change the --android flag to --ios in MobileEmulator.abprun.json or via the profile edit option in Solution Runner)

Before the first run:

  1. Install cloudflared if you have not already (see Prerequisites).
  2. Switch to the MobileEmulator profile in the Solution Runner.
  3. Open react-native/Environment.ts and follow the inline comments: uncomment the tunnel configuration block and comment out the localhost constants.

Start an Android emulator (or connect a device), then start the MobileEmulator profile.

ABP Studio Solution Runner with MobileEmulator profile selected

See Cloudflare tunnel (manual CLI) below for what the tunnel script does, and Automate Localhost Access for Expo for architecture details and troubleshooting.

Cloudflare tunnel (manual CLI)

Non-tiered React Native templates ship with a Cloudflare tunnel automation script. The tunnel gives your mobile app a temporary HTTPS URL (for example https://example.trycloudflare.com) that forwards to your local backend — without reconfiguring Kestrel or OpenIddict over HTTP.

Prerequisite: Install cloudflared on your machine using Cloudflare's Download and install cloudflared guide before running yarn tunnel:api or the MobileEmulator profile.

The template includes:

Item Location
Tunnel script react-native/scripts/tunnel.js
npm script yarn tunnel:api (runs node scripts/tunnel.js)
Generated config react-native/tunnel-config.json (created at runtime)
Environment switch Inline comments in react-native/Environment.ts

When tunnel.js runs, it:

  1. Starts cloudflared tunnel --url https://localhost:{api-port} (port matches your backend host).
  2. Captures the generated *.trycloudflare.com domain from the cloudflared output.
  3. Writes tunnel-config.json and updates the fallback value in Environment.ts.

Steps

  1. Switch Environment.ts to tunnel mode. Open react-native/Environment.ts and follow the inline comments:
    • Uncomment the tunnel configuration block (the block that reads tunnel-config.json).
    • Comment out the localhost apiUrl / appUrl constants.
  2. Start the backend host if it is not already running.
  3. Start the tunnel from the react-native folder:
yarn tunnel:api

Or:

npm run tunnel:api

Wait until the script prints ✓ Tunnel domain saved.

  1. Start Expo in a separate terminal:
yarn start
  1. Start your Android emulator, iOS simulator, or connect a physical device.

With ABP Studio: The MobileEmulator run profile performs steps 2–4 for you after you update Environment.ts.

See Automate Localhost Access for Expo for OAuth redirect considerations, troubleshooting, and development-build guidance.

If Cloudflare tunnels are unavailable, use Manual Backend Configuration as a fallback.

Manual CLI (without MobileEmulator profile)

If you are not using the MobileEmulator profile, prefer the Cloudflare tunnel workflow above. Only use Manual Backend Configuration when tunnels are unavailable.

The React Native application was generated with Expo. Expo is a set of tools built around React Native to help you quickly start an app, and it includes many features.

Expo CLI showing QR code and platform launch options

You can start the application on an Android emulator, an iOS simulator, or a physical phone by scanning the QR code or by choosing the corresponding option in the Expo CLI.

Enter admin as the username and 1q2w3E* as the password to log in to the application.

Android Studio

  1. Start the emulator in Android Studio before running yarn start, yarn android, or npm start.
  2. Press a in the Expo CLI to open on Android.

iOS Simulator

  1. Press i in the Expo CLI to open the iOS simulator (macOS only).

Contributors


Last updated: June 10, 2026 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

ABP Community Talks
Low-Code, High Precision
13 Aug, 17:00
Online
Watch the Event
ABP Live Webinar
Webinar Calendar Webinar Calendar
Discover
ABP Platform
Register Now
Oct 01
Thursday,
17:00 UTC
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.