> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revyl.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter

> Build a Flutter app for iOS and Android and run it in the dev loop.

Generate simulator builds for your Flutter app.

Prompt for your coding agent:

```text
Set up Revyl for this Flutter app.

Read https://docs.revyl.com/frameworks/flutter.md and follow it. It's the current Revyl guide for this, so prefer it over anything you remember about Revyl.

Check that `flutter doctor` passes, then build with `flutter build ios --debug --simulator` for iOS and `flutter build apk --debug` for Android.

You're done when a Revyl build of the app succeeds and the app runs on a cloud simulator or emulator.

Ask me before anything that needs my login or approval.
```

## Build Guidance

To use the [Dev Loop](/dev-loop), a build is required **on every code change**. Dart compiles into the native binary — see [Dev Loop: Hot reload and rebuild configuration](/frameworks#hot-reload-and-rebuild-configuration) for the full breakdown.
## Build via the Revyl CLI

### Prerequisites

- Flutter SDK installed (`flutter doctor` passes)
- Xcode (for iOS) or Android SDK (for Android)
- Revyl CLI installed and authenticated (`revyl auth login`)

### Setup

Initialize the project using the Revyl CLI:

```bash
revyl init
```

This detects Flutter and writes named profiles with the applicable iOS and/or
Android recipes. Review or fill in the app IDs, commands, and output paths before
the first build.

## Run Build

Run one profile/platform recipe in the cloud:

```bash
revyl build --profile development --platform ios
```

Profiles live under `build.profiles`, may contain `ios` and/or `android`, and
are never stored as active/default. See [Configuration](/remote-builds/configuration).

This command automatically builds and uploads the app to Revyl, where you can use it to start sessions.

## Advanced Configuration

When you run `revyl init`, Revyl makes a best-effort guess at your configuration. This section covers configuration in more detail.

If the build does not complete successfully modify the build commands manually in the [config.yaml file](/reference/cli/configuration).

Note: For flutter apps, use **debug builds** for better test reliability.

Debug builds provide an accurate view hierarchy extraction, better element identification, and faster execution.

Here are example commands of how to build your flutter app as a debug configuration:

```bash
# iOS debug build
flutter build ios --debug --simulator

# Android debug build
flutter build apk --debug
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="iOS build fails">
    Check Xcode configuration:
    ```bash
    flutter doctor
    sudo xcode-select --switch /Applications/Xcode.app
    ```
  </Accordion>

  <Accordion title="Android build fails">
    Clean and rebuild:
    ```bash
    flutter clean
    flutter pub get
    flutter build apk --debug
    ```
  </Accordion>

  <Accordion title="Can't find build file">
    Check build output directory:
    ```bash
    # iOS
    open build/ios/iphonesimulator/

    # Android
    open build/app/outputs/flutter-apk/
    ```
  </Accordion>
</AccordionGroup>

## Resources

- [Flutter Build Modes](https://docs.flutter.dev/testing/build-modes)
- [Flutter Debugging](https://docs.flutter.dev/testing/debugging)

## Dev loop

Flutter uses a rebuild-based dev loop (no hot reload). The CLI detects `pubspec.yaml` and configures build commands for both platforms. During `revyl dev`, press `[r]` to rebuild, upload, and reinstall on the cloud device. Typical rebuild cycle: ~30-60s.
