Skip to content
Documentation
Esc
↑↓navigate↵open⌘Jpreview
On this page

Build NitroUI apps for iOS and Android without a Mac

How Limrun prepares a NitroUI app's .nitro directory for Xcode and Gradle, and how to connect a cloud device to your NitroUI dev server.

Build a NitroUI app with lim xcode build and lim gradle build, then run it on a cloud iOS simulator or Android emulator. The builds run on Limrun sandboxes, so your own machine needs neither Xcode nor the Android SDK. That includes Linux and Windows, where NitroUI’s own tooling builds Android only.

Before you start

  • Install the CLI with npm install --global lim and set LIM_API_KEY in the shell that runs it. See Set up your coding agent for agent environments.
  • Create the app with NitroUI’s starter, bunx create-nitro-ui@latest MyApp, or use an existing NitroUI app. Run the commands on this page from the app’s root folder, the one with package.json, app.json, ios/, and android/.
  • NitroUI builds iOS with Xcode 27. Run lim xcode version to see which Xcode a sandbox uses, and see Xcode and tool versions to pin another.

How the sandbox prepares the app

A NitroUI app’s Xcode and Gradle projects build against the .nitro/ directory. nitro-ui prepare generates it from the installed packages, app.json, and your local modules, and the starter’s .gitignore excludes it, together with node_modules/. The sync skips paths your .gitignore excludes, so neither directory reaches the sandbox.

The sandbox recreates both on its side. When the root package.json lists nitro-ui-cli in dependencies or devDependencies, the build:

  1. Installs Node packages with the project’s package manager. The starter’s bun.lock selects Bun, which also runs the app’s postinstall script, nitro-ui prepare.
  2. Runs bun x --no-install nitro-ui prepare again, so .nitro/ matches the current app.json and modules.
  3. Runs xcodebuild or Gradle.

Later builds on the same sandbox skip the install while package.json and the lockfile are unchanged. The prepare step runs on every build. A build log on the sandbox starts like this:

$ bun install
...
$ bun x --no-install nitro-ui prepare
Prepared MyApp: resolved framework sources and 1 app modules.

Build for iOS

Build the app and install it on a cloud simulator:

lim xcode build . --ios

--ios reuses a recent Xcode sandbox with an attached iOS simulator, or creates and attaches both, and installs and launches every successful build on the simulator. The sandbox finds ios/NitroUI.xcodeproj and its NitroUI scheme on its own. To build another scheme, pass --scheme. Build with remote Xcode covers the other build flags, uploads, and signing.

Build for Android

Build the debug APK on a Gradle sandbox:

lim gradle build .

The sandbox finds the Gradle project in android/ and runs assembleDebug with the project’s wrapper. To install every successful build on a cloud emulator, create one and attach it to the sandbox:

lim android create --no-connect
lim gradle attach-emulator

attach-emulator installs the latest APK right away and later builds as they finish. Both commands default to the instances you created last; pass IDs to choose others. See Build with Gradle.

Load JavaScript from your dev server

A Debug build loads its JavaScript from the NitroUI dev server instead of from the app bundle. On a cloud device, the app opens to a Dev Servers list, because it cannot discover a server on your network. Start the dev server on your machine, route the device’s localhost:8081 to it, and relaunch the app with the server’s address.

Start the dev server from the app folder and keep it running:

bun run start

It listens on http://localhost:8081. In a second terminal, open a tunnel and relaunch the app with that address. The starter’s bundle identifier and Android application ID are com.example. followed by the app name in lowercase, such as com.example.myapp:

lim ios tunnel --selector localhost:8081 --detach
lim ios simctl -- launch --terminate-running-process booted com.example.myapp \
  -NitroUIDevServerURL http://localhost:8081
lim android tunnel --selector localhost:8081 --detach
lim android adb-shell -- am start -S -n com.example.myapp/.MainActivity \
  --es NitroUIDevServerURL http://localhost:8081

The tunnel sends the app’s connections to localhost:8081 through your machine, so the app reaches the dev server at the address it already uses. On Android, tapping This computer (http://localhost:8081) in the list works too once the tunnel runs. The NitroUIDevServerURL launch argument opens that server without the list, and the app remembers it for later launches, including the ones that follow each build. Save src/App.tsx and the running app shows the change. Connect to local services covers tunnel limits and traffic inspection.

lim xcode build --dev-server-url does not apply here: the sandbox accepts it only for Expo apps.

Run without a dev server

A Release build carries its JavaScript, compiled to native code, so it runs without the dev server:

lim xcode build . --ios --configuration Release
lim gradle build . --task :app:assembleRelease

The starter signs Android release builds with its debug keystore, so the APK installs on an attached emulator. To sign for Google Play or the App Store, see Sign and publish and Sign and distribute.

Limits

  • The app must sit at the root of the synced folder. The sandbox reads only the root package.json, so a NitroUI app nested in a monorepo is not detected yet. Its build runs without the install and fails on the missing .nitro/ directory, for example with the package at .nitro/app cannot be accessed.
  • The package manager must be unambiguous. A packageManager field in package.json decides. Without one, the lockfile decides, and lockfiles from two package managers, such as bun.lock next to package-lock.json, leave the choice open. The build then runs without the install and fails the same way. Keep one lockfile, or set packageManager.

Next steps

Last updated on