# `MobDev.OtpDownloader`
[🔗](https://github.com/genericjam/mob_dev/blob/master/lib/mob_dev/otp_downloader.ex#L1)

Downloads and caches pre-built OTP releases from GitHub for Android and iOS simulator.

Artifacts are cached at `~/.mob/cache/` and reused across projects. Each
tarball is checked against its SHA-256 pin in `MobDev.Download.Pins` before
it is extracted, and a cached runtime is reused only if it was extracted
from the pinned tarball.

# `android_otp_dir`

```elixir
@spec android_otp_dir(String.t()) :: String.t()
```

Returns the cached Android OTP directory path (may not exist yet).

# `bundled_elixir_version`

```elixir
@spec bundled_elixir_version(String.t()) :: String.t() | nil
```

Reads the Elixir vsn from `otp_dir/lib/elixir/ebin/elixir.app`, or nil.

# `download_url`

```elixir
@spec download_url(String.t()) :: String.t()
```

Download URL of the tarball for a runtime name (e.g. `otp-android-<hash>`).

# `download_urls`

```elixir
@spec download_urls() :: [String.t()]
```

Every tarball URL this downloader can request.

# `ensure_android`

```elixir
@spec ensure_android(String.t()) :: {:ok, String.t()} | {:error, term()}
```

Ensures the Android OTP release is cached. Returns {:ok, path} or {:error, reason}.

# `ensure_ios_device`

```elixir
@spec ensure_ios_device() :: {:ok, String.t()} | {:error, term()}
```

Ensures the iOS device OTP release is cached. Returns {:ok, path} or {:error, reason}.

# `ensure_ios_sim`

```elixir
@spec ensure_ios_sim() :: {:ok, String.t()} | {:error, term()}
```

Ensures the iOS simulator OTP release is cached. Returns {:ok, path} or {:error, reason}.

# `ios_device_otp_dir`

```elixir
@spec ios_device_otp_dir() :: String.t()
```

Returns the cached iOS device OTP directory path (may not exist yet).

# `ios_sim_otp_dir`

```elixir
@spec ios_sim_otp_dir() :: String.t()
```

Returns the cached iOS simulator OTP directory path (may not exist yet).

# `warn_on_elixir_skew`

```elixir
@spec warn_on_elixir_skew(String.t()) :: :ok
```

Warns (does not fail) when the build's Elixir minor version differs from the
Elixir bundled in the device OTP runtime at `otp_dir`.

This is the `Enum.__in__/2` class of breakage: the `in` operator and other
macros expand differently per Elixir minor, so beams compiled by 1.20 call
functions a 1.19.5 runtime lacks → `:undef` at boot → black screen with no
obvious cause. Warning (not failing) is deliberate: rc/patch transitions are
common and usually fine, and a hard fail would block legitimate builds — but
a loud warning would have turned that debugging saga into one line.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
