> ## 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.

# Android native

> Build a native Android app for Revyl and run it in the dev loop.

<Note>
  Revyl accepts `x86_64` and `arm64-v8a` native libraries, and the APK must be debuggable. See
  [Artifact Requirements](/builds/artifact-requirements#android) for the full
  rules and rationale. Default `./gradlew assembleDebug` satisfies these requirements — you
  only need to revisit this if you've customized `abiFilters` or are uploading
  release builds.
</Note>

Prompt for your coding agent:

```text
Set up Revyl for this native Android app.

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

Build the Debug variant with `./gradlew assembleDebug`, which gives a debuggable APK. Revyl needs `x86_64` or `arm64-v8a` native libraries.

You're done when a Revyl build of the app succeeds and the app runs on a cloud Android 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**. The APK **is** the app — see [Dev Loop: Hot reload and rebuild configuration](/frameworks#hot-reload-and-rebuild-configuration) for the full breakdown.

Android reinstalls preserve app data (the `-r` flag is used).

## Build via the Revyl CLI

### Prerequisites

- Revyl CLI installed and authenticated (`revyl auth login`)

### Setup

Initialize the project using the Revyl CLI:

```bash
revyl init
```

This detects the Android build and writes a named profile with its Android
recipe. Review or fill in the app ID, commands, and output path before the first
build.

### Run Build

Run a build using:
`revyl build --profile development --platform android`

This runs the selected recipe in the cloud. If your profile has a different
name, pass it explicitly; no profile is active/default. See
[Configuration](/remote-builds/configuration).

## Advanced Configuration

Revyl makes a best effort to determine the build commands to be used. If the build does not complete successfully modify the build commands manually in the [config.yaml file](/reference/cli/configuration).

## Build via Android Studio

### 1. Open Project

Launch Android Studio and open your app.

### 2. Build APK

Choose **Build → Build Bundle(s) / APK(s) → Build APK(s)**

<Note>
  Use debug builds for Revyl. Release/non-debuggable APKs install but disable
  the State tab and other debug-only inspection paths.
</Note>

### 3. Locate Build

Click **Locate** in the bottom-right notification.

APK location:

```
app/build/outputs/apk/debug/app-debug.apk
```

### 4. Upload to Revyl

See Ways to [Add Builds](/builds#ways-to-add-builds) to upload the build to Revyl.

## Troubleshooting

<AccordionGroup>
  <Accordion title="APK won't install on the cloud emulator">
    APKs with native libraries must include `x86_64` or `arm64-v8a`. Default
    debug builds ship compatible ABIs in one fat APK — this is usually only an
    issue if you've narrowed `abiFilters`.

    If you need ABI filters, include one or both supported 64-bit ABIs:

    ```gradle
    android {
        defaultConfig {
            ndk {
                abiFilters 'x86_64', 'arm64-v8a'
            }
        }
    }
    ```

    See [Artifact Requirements](/builds/artifact-requirements#android) for details.
  </Accordion>

  <Accordion title="APK not found after build">
    Check these locations:
    ```
    app/build/outputs/apk/debug/app-debug.apk
    app/build/outputs/apk/release/app-release.apk
    ```

    Or search for APK files:
    ```bash
    find . -name "*.apk"
    ```

  </Accordion>

  <Accordion title="Gradle build fails">
    Clean and rebuild:
    ```bash
    ./gradlew clean
    ./gradlew assembleDebug

    # Check dependencies
    ./gradlew dependencies
    ```

  </Accordion>

  <Accordion title="'gradlew' command not found">
    Use the wrapper in your project:
    ```bash
    # On macOS/Linux
    ./gradlew assembleDebug

    # On Windows
    gradlew.bat assembleDebug
    ```

    If missing, regenerate:
    ```bash
    gradle wrapper
    ```

  </Accordion>

  <Accordion title="Build succeeds but APK won't install on Revyl">
    Verify the APK contains an `x86_64` or `arm64-v8a` slice:
    ```bash
    aapt dump badging app-debug.apk | grep native-code
    # Should include 'x86_64' or 'arm64-v8a'
    ```
    If it contains only `x86` or `armeabi-v7a`, rebuild without `abiFilters`
    or include a supported 64-bit ABI. See
    [Artifact Requirements](/builds/artifact-requirements#android).
  </Accordion>
</AccordionGroup>

## Resources

- [Android Studio Build Guide](https://developer.android.com/studio/build)
- [Gradle Configuration](https://developer.android.com/studio/build/build-variants)
- [Android ABI Guide](https://developer.android.com/ndk/guides/abis)

## Dev loop

Native Android uses a rebuild-based dev loop. The CLI detects `build.gradle` / `build.gradle.kts` and configures `./gradlew assembleDebug`. During `revyl dev`, press `[r]` to rebuild and reinstall. Typical rebuild cycle: ~30-90s. Reinstalls preserve app data.

If an Expo or React Native project is detected as Android Native, run
`revyl init --detect` from the app directory. If detection still cannot resolve
the monorepo layout, edit `build.framework` and the generated profile recipes
in `.revyl/config.yaml`, then run `revyl config validate`.
