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

> Build Android apps using Gradle and Android Studio

Build Android APKs for Revyl's cloud emulators from Android Studio or the command line.

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

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

1. Go to **Builds** page
2. Click **Upload Build**
3. Select **Android**
4. Drag and drop your `.apk`
5. Done!

## Build via Command Line

```bash theme={null}
# Navigate to project
cd /path/to/your-android-project

# Build debug APK
./gradlew assembleDebug

# Find your APK at:
# app/build/outputs/apk/debug/app-debug.apk
```

## Build Variants

```bash theme={null}
# Debug build (recommended for testing)
./gradlew assembleDebug

# Release build
./gradlew assembleRelease

# Specific flavor
./gradlew assembleDemoDebug
```

## Authenticated Test States

Revyl launch variables are available to Android emulator apps as launch intent string extras. Use them to gate a test-only `myapp://revyl-auth` deep link.

See [Auth Bypass Deep Links](/builds/auth-bypass-deeplinks#framework-recipes) for the Kotlin snippet.

## Troubleshooting

<AccordionGroup>
  <Accordion title="APK won't install on the cloud emulator">
    Revyl's cloud emulators are `x86_64`. The APK must include `x86_64` in
    its ABI set. Default debug builds ship all ABIs in one fat APK — only
    an issue if you've narrowed `abiFilters`.

    If you need an ABI filter, include `x86_64`:

    ```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` slice:

    ```bash theme={null}
    aapt dump badging app-debug.apk | grep native-code
    # Should include 'x86_64'
    ```

    If your APK is `arm64-v8a`-only, rebuild without `abiFilters` (or with
    `x86_64` included). 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)
