> ## 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/Gradle Builds

> Create Android builds for Android native apps

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

## Build Guidance

To use the [Dev Loop](../../develop/dev-loop-overview), a build is required **on every code change**. The APK **is** the app — see [Dev Loop: Hot reload and rebuild configuration](../../develop/dev-loop-overview#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 theme={null}
revyl init
```

This creates an app, generates the necessary Revyl configuration files, runs a build, and uploads it to Revyl.

### Run Build

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

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

## 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](/cli/command-reference#config-yaml).

## 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 theme={null}
    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 theme={null}
    find . -name "*.apk"
    ```
  </Accordion>

  <Accordion title="Gradle build fails">
    Clean and rebuild:

    ```bash theme={null}
    ./gradlew clean
    ./gradlew assembleDebug

    # Check dependencies
    ./gradlew dependencies
    ```
  </Accordion>

  <Accordion title="'gradlew' command not found">
    Use the wrapper in your project:

    ```bash theme={null}
    # On macOS/Linux
    ./gradlew assembleDebug

    # On Windows
    gradlew.bat assembleDebug
    ```

    If missing, regenerate:

    ```bash theme={null}
    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 theme={null}
    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)
