# olef runtime

Source: https://olef.dev/docs/reference/cli/runtime

Generated from **Olef 3.0.2**. [All commands](https://olef.dev/docs/reference/commands) · [Capabilities and requirements](https://olef.dev/docs/reference/capabilities)

These entries describe available commands, not a sequence to run. Check prerequisites before changing app, device, or cloud state. Global options are listed in the [command catalog](https://olef.dev/docs/reference/commands#global-options).

## olef runtime

Attach and manage the in-process runtime in debuggable apps

```bash
olef runtime --help
```

Output: **json**.

Examples from the CLI (replace sample packages, selectors, and paths with your own):

```bash
olef --device emulator-5554 runtime attach --app io.github.andriyo.shadowdroid.sample
olef runtime attach --app <package> --startup --restart
```

### olef runtime attach

Attach the runtime to a debuggable app, without the server APK

```bash
olef runtime attach --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--app <APP>` | App package |
| `--pid <PID>` | App process id |
| `--startup` | Load on future app starts (API 29+), until runtime detach |
| `--restart` | Force-stop and relaunch the app, discarding its in-memory state Conflicts with: `pid`. |
| `--timeout-ms <TIMEOUT_MS>` | Maximum wait for the host daemon to become ready after deployment Default: `20000`. |
| `--coroutine-probes` | Track coroutines with kotlinx DebugProbes from the moment the runtime starts (with --startup: from process start) for `runtime coroutines` |
| `--json` | Accepted for compatibility; output is always JSON. |

Examples from the CLI (replace sample packages, selectors, and paths with your own):

```bash
olef --device emulator-5554 runtime attach --app io.github.andriyo.shadowdroid.sample
olef runtime attach --app <package> --startup --restart
```

### olef runtime status

List live runtime sessions (read-only on the device)

```bash
olef runtime status --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--app <APP>` | App package |
| `--pid <PID>` | App process id |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef runtime detach

Detach and remove the app's startup runtime agent

```bash
olef runtime detach --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--app <APP>` | App package |
| `--pid <PID>` | App process id |
| `--all` | Detach every session and remove known startup agents on the selected device Conflicts with: `app`, `pid`. |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef runtime coroutines

Dump the app's live coroutines (state, context, stacks) via kotlinx DebugProbes, with no build changes; attaches the runtime if needed

```bash
olef runtime coroutines --help
```

Output: **human_or_json**.

| Argument | Description |
| --- | --- |
| `--app <APP>` | App package |
| `--pid <PID>` | App process id |
| `--dump` | Include the full DebugProbes text dump (job hierarchy + stack traces) |
| `--frames <FRAMES>` | Stack frames to show per coroutine in the structured list (0 = none) Default: `6`. |
| `--limit <LIMIT>` | Cap the structured coroutine list (state counts are always complete) Default: `200`. |
| `--out <OUT>` / `-o` | Write the full text dump to this file (implies the dump is collected) |
| `--json` | Emit a single JSON object instead of human-readable text |
